Table of Contents

Custom Online maps


Basic information

Sample map

A example of OpenPiste map (OSM based) created from three layers:

  1. background layer not visible in the map list but required.
  2. contour layer, visible but not really required. If this layer is not visible on some places and when the server returns 404 code for missing tiles you can still see background layer.
  3. shade layer, also not required. This layer is visible in the map list - fill correct “mode” and “area” (optional).

Referer added to the header is not recommended in this case.

Map code in providers.xml file

providers.xml
<?xml version="1.0" encoding="UTF-8"?>
    <providers>
       <provider id="1000" type="0" visible="false" required="true" background="-1">
          <name>OSM</name>
          <mode>background</mode>
          <url><![CDATA[http://tiles.openpistemap.org/nocontours/{z}/{x}/{y}.png?v={ts}]]></url>
          <zoomPart>{z}-8</zoomPart>
          <zoomMin>8</zoomMin>
          <zoomMax>24</zoomMax>
          <tileSize>256</tileSize>
          <tileScale dpi="0" multi="2.0" replace="19" />
          <extraHeader>Referer#http://locus.asamm.cz/</extraHeader>
       </provider>
       <provider id="1001" type="0" visible="false" required="false" background="1000">
          <name>OSM</name>
          <mode>contours</mode>
          <url><![CDATA[http://tiles.openpistemap.org/contours-only/{z}/{x}/{y}.png?v={ts}]]></url>
          <zoomPart>{z}-8</zoomPart>
          <zoomMin>8</zoomMin>
          <zoomMax>24</zoomMax>
          <tileSize>256</tileSize>
          <tileScale dpi="0" multi="2.0" replace="19" />
          <extraHeader>Referer#http://locus.asamm.cz/</extraHeader>
       </provider>
       <provider id="1002" type="0" visible="true" required="false" background="1001">
          <name>OSM</name>
          <mode>OpenPiste</mode>
          <url><![CDATA[http://tiles2.openpistemap.org/landshaded/{z}/{x}/{y}.png?v={ts}]]></url>
          <zoomPart>{z}-8</zoomPart>
          <zoomMin>8</zoomMin>
          <zoomMax>24</zoomMax>
          <tileSize>256</tileSize>
          <tileScale dpi="0" multi="2.0" replace="19" />
          <countries>World</countries>
          <usage>hiking,ski</usage>
          <extraHeader>Referer#http://locus.asamm.cz/</extraHeader>
       </provider>
    </providers>

Specifications of map definition

ZoomValues (zoomMin, zoomMax) have to be counted as valid zoom level by 2^x. So the whole World has one tile 256×256 px, which means 2^8, so X = 8!. That's why almost all maps in Locus start with zoomMin = 8 but have zoomPart {z} - 8. This is because in URLs zooms usually start from 0 to some max value.

This solution should be improved so if you have any ideas, tell us. Also, an experienced Android developer on should be able to create some mechanism for adding external providers through ContentProviders or services.

Now you know syntax of providers so you should add your custom ones. Please, share links with others and enjoy!

Hints

How to obtain required info

We recommend to use Firefox browser with extension HttpFox:

Another sample of custom online map can be Strava Global Heatmap XML file that we prepared together with our users. It contains cycling and running layers and can be downloaded here >>. Just unzip it in Locus/mapsOnline/custom directory and enjoy!

Own Open Map Tile Server

Disabling map downloading limit

If you operate your own map tile server you may need to cancel tile downloading limit that is set in Locus by default in order to maintain decent downloading traffic per application:

  1. Enable mod_headers: sudo a2enmod headers
  2. Edit the Apache configuration file (/etc/apache2/apache2.conf) and add at the end: Header set locus_disable_download_limit “true”