This is an old revision of the document!
Table of Contents
Online Help > AlpineQuest 2.x > Maps & Layers
How to create custom maps?
The application uses an XML based format for its maps configuration. Files must have an .AQX
extention and be placed in the “[application folder]/cache/custom-maps/
” folder.
See how to locate the application folder here.
Basic example
Here is a simple example to access the default http://www.openstreetmap.org/ map:
- TEST1.AQX
<?xml version="1.0" encoding="utf-8" ?> <aqx version="7"> <name>Simple Test AQX</name> <description>© OpenStreetMap</description> <source id="MAP01"> <name>Standard Mapnik</name> <zoom-levels z="3,5,7,8,9,10,11,12,13,14,15,16,17"> <server><![CDATA[http://a.tile.openstreetmap.org/{$z}/{$x}/{$y}.png]]></server> </zoom-levels> </source> </aqx>
This example will be displayed like this in the application:
Note that the application will recognize the {$x}
, {$y}
and {$z}
variable and replace them with correct values.
The source id
field must be unique in the file, and contains only characters and numbers. It is used internally by the application to identify the data storage of the map.
Advanced example
A lot of optional fields have been omitted in the basic example, so here is a more complete example:
- TEST2.AQX
<?xml version="1.0" encoding="utf-8" ?> <aqx version="7"> <name>Simple Test AQX</name> <description>© OpenStreetMap</description> <source id="MAP01"> <name>Standard Mapnik</name> <outline>2.54,49.49 2.54,51.51 6.41,51.51 6.41,49.49</outline> <preview-location>5.90,44.80,12</preview-location> <zoom-levels z="3,5,7,8,9,10,11,12,13,14,15,16,17"> <update-delay>3M</update-delay> <max-threads>2</max-threads> <user-agent>MyApp</user-agent> <referer><![CDATA[http://www.openstreetmap.org/]]></referer> <server><![CDATA[http://a.tile.openstreetmap.org/{$z}/{$x}/{$y}.png]]></server> <server><![CDATA[http://b.tile.openstreetmap.org/{$z}/{$x}/{$y}.png]]></server> <server><![CDATA[http://c.tile.openstreetmap.org/{$z}/{$x}/{$y}.png]]></server> </zoom-levels> </source> </aqx>
An <outline>
tag (pairs of longitudes/latitudes, space separated) can be used to define the area covered by the map. When the map is selected while another area is displayed, the application will ask the user if he wants to move the map over the covered area.
The <preview-location>
tag (approximate longitude, latitude and OSM zoom id) allows the application to display the map with a preview background:
The <update-delay>
tag indicates after how many time the stored map data should be updated if it's used again. The default is None
, meaning the application will never try to update the stored data. Must end with D
(number of days), W
(weeks), M
(months) or Y
(years). 3M
means 3 months
. Use 0D
to force the application to update the data on each display.
Quadtree encoded tiles
Instead of using the {$x}
, {$y}
and {$z}
variables, you can use the {$q}
variable that contains the quadtree encoded coordinates of the tiles, like in this example:
<source id="MAP02"> <name>Quadtree Map Example</name> <zoom-levels z="3,5,7,8,9,10,11,12,13,14,15,16,17"> <server><![CDATA[http://map.example.com/tiles/{$q}]]></server> </zoom-levels> </source>
Custom variables
In addition to the variables provided by default, you can create your own variables defined by mathematical expressions:
<source id="MAP03"> <name>Custom Variables Map Example</name> <zoom-levels z="3,5,7,8,9,10,11,12,13,14,15,16,17"> <expression set="my_variable" type="int">iif( z>10, x*y, x+y )</expression> <server><![CDATA[http://map.example.com/tiles/{$my_variable}.png]]></server> </zoom-levels> </source>
The “set
” attribute defines the name of the custom variable, the “type
” attribute tells how to display the variable (either int
, long
, float
or double
).
WMS servers
To access WMS servers, just use the {$bbox}
variable. You can specify the coordinate system of the bounding box using the <bbox-crs-code>
tag.
<source id="MAP04"> <name>WMS Map Example</name> <zoom-levels z="3,5,7,8,9,10,11,12,13,14,15,16,17"> <bbox-crs-code>EPSG:4326</bbox-crs-code> <server><![CDATA[http://server.example.com/wms/Service?REQUEST=GetMap&VERSION=1.1.1&LAYERS=layer&FORMAT=image/png&BBOX={$bbox}&SRS=EPSG:4326&WIDTH=256&HEIGHT=256]]></server> </zoom-levels> </source>