Menu

user_maps

Marián Zubák

User defined map sources

If there is any web server with map source which is not yet included in, it can be added by user map source definition. It is necessary to create file with map definition and store it in UserMaps folder.

Structure of definition file is based on xml format with a few key nodes:

  • group
    • layer
    • name
    • description
    • copyright
    • projection
    • zoomlevels
      • level
    • tile
    • calibration
      • lefttop
      • rightbottom
      • tiles
    • url
    • cache

group is used only when map has more layers, for example some transparent layers with paths. Then group can contain more layer nodes for each layer. Group must have attribute name. See example 3

layer can be root node or child of group. If more layers are used, dependent layers have attribute base with name of parent layer. See example 3. Layer must have at least name, tile, zoomlevels and url nodes. See examples for usage of those nodes.

zoomlevels must contain at least one level node. Level node must have id attribute. Text is used as label for zoom menu and id is used for %level replacement in url links. Optionally there can be used attributes left, top, right, bottom if map must be cropped to some local area. See example 4.

tile must have attributes width and height in pixels. It is size of tiles used in map.

calibration contains tiles nodes for each zoomlevel. Attribute level must be identical to zoomlevels/level id attribute. Attributes horizontal and vertical are count of tiles for each map zoom level. It can have optional nodes lefttop and rightbottom for defining smaller area on the Earth, default is whole Earth area. See example 1

url node can be used more times if server offers more links to map tiles. It contains link to server with 3 replaceable parameters:

  • %level - will be replaced with layer/level id attribute
  • %x or %1x,%2x ...
  • %y or %1y, %2y, %3y ...

%x,%y will be replaced with indexes to each map tile (its position on map)
\%1x, %2x, %1y ... are just single digits from %x numbers on each position in number. For example if %x = 2573 then %1x = 3, %2x = 7, %3x = 5, %4x = 2, %5x = 0, %6x = 0 and so on. This can be used if server have tiles stored in multiple folders. See example 2.

cache is optional and contains string to subfolder in cache also with 3 replaced parameters %level, %x, %y.


Example 1

~~~~~~~~~~~~~~
<layer>
<name>example1</name>
<description>OpenStreetMap - Mapnik</description>
<copyright>(c) OpenStreetMap</copyright>
<projection>Mercator</projection>
<zoomlevels>
<level id="1">level1</level>
<level id="3">level3</level>
<level id="4">level4</level>
<level id="2">level2</level>
<level id="5">level5</level>
<level id="6">level6</level>
<level id="7">level7</level>
</zoomlevels>
<tile width="256" height="256"/>
<calibration>
<lefttop longitude="-180" latitude="85.0511287798066"/>
<rightbottom longitude="180" latitude="-85.0511287798066"/>
<tiles level="1" horizontal="2" vertical="2"/>
<tiles level="2" horizontal="4" vertical="4"/>
<tiles level="3" horizontal="8" vertical="8"/>
<tiles level="4" horizontal="16" vertical="16"/>
<tiles level="5" horizontal="32" vertical="32"/>
<tiles level="6" horizontal="64" vertical="64"/>
<tiles level="7" horizontal="128" vertical="128"/>
</calibration>
<url>http://a.tile.openstreetmap.org/%level/%x/%y.png</url>
<url>http://b.tile.openstreetmap.org/%level/%x/%y.png</url>
<url>http://c.tile.openstreetmap.org/%level/%x/%y.png</url>
<cache>usermap1\%level\%x_%y.png</cache>
</layer>
~~~~~~~~~~~~~~~~

Example 2

<layer>
<name>example2</name>
<description>Forest Roads of Slovakia (NLC Zvolen)</description>
<projection>Mercator</projection>
<zoomlevels>
<level id="10" left="559" top="348" right="576" bottom="357">level10</level>
<level id="13">level13</level>
<level id="14">level14</level>
</zoomlevels>
<tile width="256" height="256"/>
<calibration>
<tiles level="10" horizontal="1024" vertical="1024"/>
<tiles level="13" horizontal="16384" vertical="16384"/>
<tiles level="14" horizontal="32768" vertical="32768"/>
</calibration>
<url>http://mapy.hiking.sk/tiles/tzt/%level/%9x%8x%7x/%6x%5x%4x/%3x%2x%1x/%9y%8y%7y/%6y%5y%4y/%3y%2y%1y.png</url>
<cache>NLC_Zvolen2\%level\%x_%y.png</cache>
</layer>
~~~~~~~~~~~~~~~~~~~~

Example 3
=====

~~~~~~~~~~~~~~~~~~~~~
<group name="example 3">
<layer>
<name>example3</name>
<description>Forest Roads of Slovakia (NLC Zvolen)</description>
<projection>Mercator</projection>
<zoomlevels>
<level id="14">level14</level>
<level id="15">level15</level>
</zoomlevels>
<tile width="256" height="256"/>
<calibration>
<tiles level="14" horizontal="16384" vertical="16384"/>
<tiles level="15" horizontal="32768" vertical="32768"/>
</calibration>
<url>http://gpsteam.eu/cache/nlcmm/%level/%y/%x.png</url>
<cache>NLC_Zvolen\%level\%x_%y.png</cache>
</layer>
<layer base="example3">
<name>example3a</name>
<description>Hiking paths gpsforum.sk</description>
<projection>Mercator</projection>
<zoomlevels>
<level id="14">level14</level>
<level id="15">level15</level>
</zoomlevels>
<tile width="256" height="256"/>
<calibration>
<tiles level="14" horizontal="16384" vertical="16384"/>
<tiles level="15" horizontal="32768" vertical="32768"/>
</calibration>
<url>http://gpsteam.eu/cache/tzt/%level/%x/%y.png</url>
<cache>NLC_Zvolen\%levelT\%x_%y.png</cache>
</layer>
</group>
~~~~~~~~~~~~~~~~~

Example 4
=====

~~~~~~~~~~~~~~~
<layer>
<name>example4</name>
<description>Bergfex</description>
<zoomlevels>
<level id="9" left="269" top="175" right="281" bottom="182">level1</level>
<level id="10" left="538" top="351" right="562" bottom="363">level2</level>
<level id="11" left="1077" top="703" right="1123" bottom="726">level3</level>
<level id="12" left="2154" top="1406" right="2245" bottom="1452">level4</level>
<level id="13" left="4309" top="2813" right="4490" bottom="2904">level5</level>
</zoomlevels>
<tile width="256" height="256"/>
<calibration>
<tiles level="9" horizontal="512" vertical="512"/>
<tiles level="10" horizontal="1024" vertical="1024"/>
<tiles level="11" horizontal="2048" vertical="2048"/>
<tiles level="12" horizontal="4096" vertical="4096"/>
<tiles level="13" horizontal="8192" vertical="8192"/>
</calibration>
<url>http://static2.bergfex.at/images/amap/%level/%level_%x_%y.png</url>
<url>http://static3.bergfex.at/images/amap/%level/%level_%x_%y.png</url>
<url>http://static4.bergfex.at/images/amap/%level/%level_%x_%y.png</url>
</layer>

Related

Wiki: Help

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.