Table of Contents
At the heart of ActiMap is the full-screen map page used to display an online or offline map along with any plotted tracks or waypoints, a location indicator, and other key visible artifacts. This full-screen map is built using OpenLayers, an open-source mapping software suite that allows the app to display any XYZ (tile) map as well as other map types. Collectively, these base maps are referred to as Map Sources. (An online map is also known as a map source; an offline map includes the definition of the map source from which the map data was, or is being, downloaded.).
ActiMap itself has no hard-coded or built-in knowledge of any map sources, other than licensing information in specific known instances; instead the definitions of the map sources (their names, types, how to access them, etc) are dynamically read from '.xml' files - either imported, or downloaded from the ActiMap online map sources library of official and community maps. These definitions are effectively metadata ('data about data') used to configure OpenLayers to access and display that particular map. This extensible architecture means that it is possible, with a little knowledge, to add your own map sources to ActiMap by generating a '.xml' definition file and then importing it.
For the very technical, a useful piece of software is the free Windows tool 'Fiddler Classic', by Telerik. In cases where there is a public facing map viewer, but the API documentation is not easy to follow or is inaccessible, this tool lets you monitor the web traffic in order to determine the URLs and requests needed to access the underlying web service. By zooming in and out, and panning up and down, it is easy to work out the placement of the X, Y, and Z values in a XYZ tile map source URL.
Important Note: The Map Service URL is not simply the URL of the public facing website!
ActiMap uses XML to define all of its map sources. This XML is held in one or more '.xml' files, which when exported is typically given the name 'MapSources.xml'.
XML standards for EXtensible Markup Language. It represents a human-readable file format for expressing and transmitting data. It is analogous to, and identical in structure to, HTML (HyperText Markup Language) as used for the expression of web page layout and content. At the most basic, the syntax of both is the same and comprises a nested set of 'elements' each of which can have one or more 'attributes' and element 'content', for example:
<ThisIsAnElement thisisanattribute="any value" thisisanotherattribute="another value">
<ThisIsAnotherElement yetanotherattribute="another value">This is some content</ThisIsAnotherElement>
</ThisIsAnElement>
The key points to note here are:
Elements can be nested within other elements - the convention is to indent them
Elements can contain zero or more attributes - their values are surrounded by double quotes
Elements can contain arbitrary text content - the text is not surrounded by quotes
Every 'opening' <Element> is paired with a 'closing' </Element> - the element name prefixed with '/'
The full list of supported elements and attributes in the context of the definition of map sources is given in the next section, together with some real-World examples at the end of this document. ActiMap supports the export or sharing of map source definitions, so if you need further examples for reference, you can always export any which have been imported, and examine the generated XML.
Note: The Export and Share function is not supported by the free edition (ActiMap Free).
When defining one or more Map Sources within an XML file, the XML must be valid according the specification detailed in the sections below. One key thing to remember: A valid file must always contain a single top-level <MapSources> element, beneath which there may be one or more <MapSource> elements - one for each map source definition.
Note: XML specifications are defined using a formal XML Schema (.xsd), one of which does exist for map source definitions. However that it is beyond the intended technical scope of this documentation.
This is the top-level element, which must always be present in a valid Map Source XML file.
Parent: None
Attributes: None
Represents a single map source definition within the file.
Parent: <MapSources>
Attributes:
guid - defines a unique value (Global Unique Identifier) for identifying the map source. GUIDs are hexadecimal and of the form 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'. All official and community map sources in the ActiMap online library are assigned unique identifiers which allows them to be automatically updated should details of their map services change. It is not necessary to specify a value for a user-defined map source - one will be allocated automatically when it is imported.
minzoom - specifies the minimum zoom level of the map (how far out the user can zoom). For a Web Mercator projection, the minimum allowable zoom level is '1' which represents a single view of the entire World. For a custom projection, the minimum allowable zoom level will be the zero-based index into the list of custom resolutions or scales provided, and will typically be '0'.
maxzoom - specifies the maximum zoom level of the map (how far in the user can zoom). For a Web Mercator projection, there is no technical maximum, but map services will typically support maximum zoom levels in the range of 15 - 18, which roughly correspond to equatorial ground scales of 1:18,000 - 1:2,200. For a custom projection, the maximum alowable zoom level will be one less than the number of provided custom scales or resolutions.
defaultzoom - specifies the default zoom level at which the map is displayed when first shown. If no value is specified, then a default somewhere between the maximum and minimum is chosen.
maxfreezoom - specifies the maximum zoom level permitted for the free edition of ActiMap (ActiMap Free). This will not typically be specified for any user-defined map sources. Note: For all official map sources, any value specified in the XML may be overridden and a hard-coded value based on any obtained license used.
maxdownloadtype - specifies the most severe or aggressive type of download supported by the map service according to the provider's licensing and terms of use. Most have no limitation, while some have restrictions on size or caching duration. When creating a user-defined map source it is strongly suggested that the licensing terms of the map provider are checked and adhered to, although of course this cannot be enforced, and for solely 'personal use' is unlikely to be of concern. If no value is specified, the the default of 'bulk' is assumed. Note: For all official map sources, any value specified in the XML may be overridden and a hard-coded value based on any obtained license used. Supported values are:
'bulk' - full bulk download is supported up to the maximum size permitted by the running edition of ActiMap.
'ondemand' - map tiles and data are downloaded and stored as they are first accessed. (*)
'intellicache' - similar to 'ondemand', but downloaded tiles can age and require online refreshing - a process which happens automatically. (*)
'none' - no offline access is permitted.
region - specifies the geographic region of coverage of the map. This will be either a 2-character ISO-3166 country code or one of the special values: '00' (World) or '01' (Europe). If no value is specified, then a default of '00' is assumed.
projection - specifies the projection of the map in EPSG notation, e.g. EPSG:3857, EPSG:27700, etc. If no value is specified, then the default of EPSG:3857 (Web Mercator) is assumed. If a different (custom) projection is specified, then this must be supplemented by defining an origin and a set of scales or resolutions for the map source.
type - specifies the type of map service. If no value is specified, then the default of 'XYZ' is assumed. Supported values are:
'ImageWMS' - a map service which adheres to the OpenGIS® Web Map Service (WMS) specification. The map is not provided as a set of tiles; instead, when viewing a map, a single web request is made which returns a single map image filling the ActiMap full-screen map display. When downloading from a web service of this type, it is treated as if it were 'TileWMS' service. WMS version 1.3.0 is assumed, but may be overridden with the <WmsService> element.
'TileWMS' - a map service which also adheres to the OpenGIS® Web Map Service (WMS) specification, but where web requests are made to retrieve individual 256x256 images corresponding to standard web tiles. Note that depending on the map images being rendered, there may be artifacts or misalignments at the borders of each virtual 256x256 tile. WMS version 1.3.0 is assumed, but may be overridden with the <WmsService> element.
'XYZ' - a standard XYZ tile map service.
ignorecertificaterrors - indicates if any SSL certificate errors are to be ignored. If no value is specified, then the default of 'False' is assumed. When you access secure websites (https:) the site must provide a valid security certificate; if it does not, then there is a security risk and your browser will typically display a security warning. The same is true of map services, most of which now require a secure connection (https). However some OpenSource map services let the certificates lapse or do not provide true public-facing certificates. To access such a map source, certificate errors should be ignored by specifying 'True'.
minversion - specifies the minimum version of ActiMap required to be able to access the map source. This will not typically be specified for any user-defined map sources. Note: As more complex map sources are added to the official map sources library, these will often require additional support in ActiMap itself, so many of these will have a value specified.
(*) 'ondemand' and 'intellicache' download types will be available in ActiMap Pro only, when released.
Provides a link to the public-facing website containing a map viewer for the map source, or the most appropriate URL if there is none.
Parent: <MapSource>
Attributes: None
The URL is provided as the text content of the element, for example:
<Website>https://opentopomap.org//</Website>
Provides a description of the map source, which is displayed when listed within ActiMap.
Parent: <MapSource>
Attributes: None
The description is provided as the text content of the element, for example:
<Description>World topographic map with hillshading, contours, and hiking & biking layers from opentopomap.org</Description>
Defines the ground resolutions at each zoom level for a map source using a custom projection, i.e. other than Web Mercator. Ground resolutions in effect define how much each pixel represents in real-world distance. They are likely to be values specific to the map source provider and will be detailed in their API documentation.
Parent: <MapSource>
Attributes: None
Resolutions are provided as comma-separated text content of the element, with one value given for each supported zoom level, for example:
<Resolutions>896,448,224,112,56,28,14,7,3.5,1.75</Resolutions>
For a custom map projection, only one of <Resolutions> or <Scales> should be specified. if both sets of values are provided, then the defined scales take precedence.
Defines the scales at each zoom level for a map source using a custom projection, i.e. other than Web Mercator. Scales define the relationship between the size of something on the map and its size in the real world, and are values likely to be familiar to those who use paper maps - 1:25000, 1:50000, and so on. The actual values will to be specific to the map source provider and will be detailed in their API documentation.
Parent: <MapSource>
Attributes:
gisconversion - defines how scales are to be converted mathematically to and from resolutions. Different GIS software from different providers use slightly different mechanisms. The exact value chosen is unlikely to make any difference, but in some cases may cause problems when using pinch-to-zoom and zoom level boundaries are crossed. Sometimes some trial-and-error is required to determine the correct value! If no value is specified, the the default of 'ExactIpm' is assumed. Supported values are:
'ExactIpm' - conversion is done using 0.0254 metres per inch
'RoundedIpm' - conversion is done using 39.37 inches per metre.
Scales are provided as comma-separated text content of the element, with one value given for each supported zoom level, for example:
<Scales gisconversion="RoundedIpm">4000000,2500000,1250000,600000,400000,200000,100000,50000,25000,10000</Scales>
For a custom map projection, only one of <Resolutions> or <Scales> should be specified. if both sets of values are provided, then the defined scales take precedence.
Defines the location of the 'top left' corner of the map area covered by a map source using a custom projection. The actual coordinate values will to be specific to the map source provider and will be detailed in their API documentation.
Parent: <MapSource>
Attributes: None
The coordinates are provided as the text content of the element in the format 'X,Y' (in units according to the map source's projection), for example:
<Origin>-238375,1376256</Origin>
Allows the default behaviour of a map source of type 'ImageWMS' or 'TileMWS' to be altered, optionally within a specific zoom range.
Parent: <MapSource>, <ZoomLevel>
Attributes:
version - specifies the version of WMS used by the web service. If the <WmsService> element is not used, or no attribute value is given, then version 1.3.0 is assumed.
crs - specifies the Coordinate Reference System or projection used by the web service, e.g. EPSG:3857, EPSG:27700, etc. If the <WmsService> element is not used, or no attribute value is given, then this will default to the projection of the map source, which itself defaults to 'EPSG:3857'. Occasionally a WMS service will required a CRS in a notation other than EPSG, or use an alternate EPSG value for the same projection, which is why this override is supported.
Defines the map service URL from which map tiles or images are requested by the map source, optionally within a specific zoom range.
Parent: <MapSource>, <ZoomRange>
Attributes: None
The URL is provided as the text content of the element, for example:
<UrlTemplate>https://{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png</UrlTemplate>
The URL template can contain a number of different placeholder values:
{a-j} - represents a range of sub-domains to which requests can be made. For reasons of performance, load sharing, and legacy browser support, some map services allow web requests to be made from one of a number of different URLs. Up to ten sub-domains are theoretically supported, although in practice the limit is usual four - i.e. a range of {a-d}. When map service requests are made, each consecutive request is made cyclically from a different sub-domain.
{x} - represents the X (horizontal) index of required tile for an XYZ tile map service.
{y} - represents the Y (vertical) index of the required tile for an XYZ tile map service.
{z} - represents the zoom level of the required tile for an XYZ tile map service.
{q} - represents a BingMaps QuadKey of the required tile for an XYZ tile map service which supports the QuadKey tile addressing system. A BingMaps QuadKey combines the X, Y, and Z components into a single key string. A tile URL template should contain either {q} or the {x}/{y}/{z} combination, but not both.
{k} - represents the API key required to access the web service. Some providers require user registration in order to access them, at which point a unique API key for tracking and licensing purposes can provided. The {k} placeholder indicates where this will be included in the URL. When a {k} placeholder is used in a user-defined map source, the user will be required to enter a valid key in order to view the map in ActiMap. Note: For all official map sources requiring an API key, the hard-coded and embedded licensed key will be used.
Specifies any headers which are to be included in all web requests to the map service, optionally within a specific zoom range.
Parent: <MapSource>, <ZoomRange>
Attributes: None
Headers are not usually needed by a map service, but if required, one or more may be specified with child <Header> elements.
Specifies an individual header which is to be included in all web requests to the map service.
Parent: <Headers>
Attributes:
name - specifies the name of the header, typical values of which might be 'referer' or 'key'. The map source provider's API documentation should explain which headers are required and under which circumstances. Header names must be unique.
value - provides the value of the header. This may include the {k} placeholder if the map source authenticates using a header value instead of the URL, which is more common. Details of the meaning of the {k} placeholder are given in the discussion of the <UrlTemplate> element.
Defines the coordinates of the centre of the map display to use the first time the map is shown.
Parent: <MapSource>
Attributes: None
The coordinates are provided as the text content of the element in the format 'latitude, longitude' (in degrees), for example:
<Start>63.7,-102.6</Start>
If no starting coordinates are defined, then the map is initially centred based on the map's region as given with the MapSource region attribute.
Allows different map services to be used for different ranges of zoom levels between the map source's defined minzoom and maxzoom attribute values.
Parent: <MapSource>
Attributes: None
Zoom ranges are not usually needed to define a map source, but if desired, one or more may be specified with child <ZoomRange> elements. Where used, a zoom range will typically be specified to provide a better base map for lower zoom levels where often the main basemap becomes too small to read.
Represents the details of a map service to use within a specific range of zoom levels lying between the map source's defined minzoom and maxzoom attribute values.
Parent: <ZoomLevel>
Attributes:
minzoom - specifies the minimum zoom level at which the zoom range applies (how far out the user can zoom). If less than the map source's defined minzoom attribute value, then the greater value will be used. Further details on zoom levels in general are given in the discussion of the <MapSource> element.
maxzoom - specifies the maximum zoom level at which the zoom range applies. (how far in the user can zoom). If greater that the map source's defined maxzoom attribute value, then the lesser value will be used. Further details on zoom levels in general are given in the discussion of the <MapSource> element.
type - corresponds exactly to the equivalent attribute at the map source level, but applied to this zoom range specifically. Full details are given in the discussion of the <MapSource> element.
ignorecertificateerrors - corresponds exactly to the equivalent attribute at the map source level, but applied to this zoom range specifically. Full details are given in the discussion of the <MapSource> element.
Note: When making use of zoom ranges, all zoom levels between the map source's minimum and maximum supported levels should be covered, with no overlaps or gaps. Failure to do so may result in unexpected behaviour when viewing the map.
For reference, below are some examples of map source XML taken from the ActiMap online library of official map sources.
This is an example of the simplest map source type - one using an XYZ tile map service in the Web Mercator projection. Most free online maps use map sources such as this.
<MapSource name="OpenTopoMap" region="00" minzoom="1" maxzoom="16">
<Website>https://opentopomap.org//</Website>
<Description>World topographic map with hillshading, contours, and hiking & biking layers from opentopomap.org</Description>
<UrlTemplate>https://{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png</UrlTemplate>
<Start>49.0,9.0</Start>
</MapSource>
This is a further example of a map source using a simple XYZ tile map service in the Web Mercator projection. However, in this case, slightly different service URLs are required for different zoom levels. This also includes a {k} placeholder which is the API key licensed to ActiMap itself.
<MapSource name="LINZ Maps" region="NZ" minzoom="5" maxzoom="15" defaultzoom="5">
<Website>http://www.topomap.co.nz//</Website>
<Description>Land Information of New Zealand topographic maps at 1:250000 and 1:50000</Description>
<UrlTemplate>https://tiles-a.data-cdn.linz.govt.nz/services;key={k}/tiles/v4/layer=767/EPSG:3857/{z}/{x}/{y}.png</UrlTemplate>
<ZoomRanges>
<ZoomRange minzoom="5" maxzoom="10">
<UrlTemplate>https://tiles-a.data-cdn.linz.govt.nz/services;key={k}/tiles/v4/layer=50798/EPSG:3857/{z}/{x}/{y}.png</UrlTemplate>
</ZoomRange>
<ZoomRange minzoom="11" maxzoom="15">
<UrlTemplate>https://tiles-a.data-cdn.linz.govt.nz/services;key={k}/tiles/v4/layer=50767/EPSG:3857/{z}/{x}/{y}.png</UrlTemplate>
</ZoomRange>
</ZoomRanges>
</MapSource>
This probably represents the most complex type of map source using an XYZ tile map service. It is in a custom projection (EPSG:27700 - British National Grid), with custom zoom levels and resolutions. This also shows how the {k} placeholder for the API key can be specified as a request header and not in the URL. For map sources such as this, the provider (in this case Ordnance Survey) will supply documentation on how to configure access to their web services with a custom projection.
<MapSource name="OS Premium Leisure Map" region="GB" projection="EPSG:27700" maxdownloadtype="Intellicache" minzoom="0" maxzoom="9" maxfreezoom="7" defaultzoom="0" minversion="2.2.0.0">
<Resolutions>896,448,224,112,56,28,14,7,3.5,1.75</Resolutions>
<Origin>-238375,1376256</Origin>
<Website>https://osdatahub.os.uk</Website>
<Description>Ordnance Survey Landranger 1:50000 and Explorer 1:25000 maps (OSGB36)</Description>
<UrlTemplate>https://api.os.uk/maps/raster/v1/zxy/Leisure_27700/{z}/{x}/{y}.png</UrlTemplate>
<Headers>
<Header name="key" value="{k}" />
</Headers>
<Start>53.1948712,-2.3713144</Start>
</MapSource>
This an example of a map source using a map service which adheres to the OpenGIS® Web Map Service (WMS) specification. Note that very little information is needed in the URL template. This is because the format of the constructed URL is strictly defined by the WMS specification and is handled automatically by ActiMap.
<MapSource name="NRC Toporama (en) - WMS" region="CA" minzoom="4" maxzoom="15" defaultzoom="4" type="ImageWMS" minversion="1.1.1.0">
<Website>http://atlas.gc.ca/toporama/en/</Website>
<Description>The Atlas of Canada - topographic maps from Natural Resources Canada to 1:50000</Description>
<UrlTemplate>https://maps.geogratis.gc.ca/wms/toporama_en?LAYERS=WMS-Toporama</UrlTemplate>
<Start>63.7,-102.6</Start>
</MapSource>