Online maps
Online maps load their tiles from a map server while you use them. You need an internet connection, but nothing to download first. Cartograph Maps keeps the tiles it has shown in a cache, and you can save the tiles of an area for offline use (see Offline use).
Online maps are in the map manager (Maps), on the Online tab. Load a map like any other map; several maps can be stacked as layers, for example an online satellite map under a transparent overlay.
Menu entries marked (PRO) need Cartograph Pro.
Add an online map
Tap + on the Online tab:
| Entry | What it does |
|---|---|
| Add folder | A folder to sort your online maps. |
| Add online map | The built-in list of free online maps (see below). |
| Add custom online map | Your own tile server: Tile raster or Mapbox vector tile (MVT) (see Your own tile server). |
| Add WMS map | A Web Map Service (see WMS). |
| Add WMTS map | A Web Map Tile Service (see WMTS). |
| Import map file | An .onlinemap file on your device (see Importing online maps). |
| Special online maps | MapLibre styles with raster sources (see How to use MapLibre maps). |
The built-in list
Add online map shows the free maps that come with the app: OpenStreetMap, OpenTopoMap, the OpenSeaMap overlay, two OpenSlopeMap.org slope maps, the Mapilion vector map and a NASA WMS. Pick one and tap Install. The folder 3rd party maps opens the page with more maps (below). The list is loaded from our server, so it can grow without an app update.
More ready-made maps (Google, IGN France, swisstopo, Yandex, Baidu, Gaode, …) are on the Online maps page: tap Install there and the app adds them.
Install maps from a link or a file
An .onlinemap file describes one or more online maps. Open an install link
(cartograph-s://…/maps.onlinemap), open the file with Cartograph Maps, or use Import map
file. Details: Importing online maps.
To make such a file for your own tile server without writing JSON, use the online map creation tool: enter the server address, check the preview and install the map with one tap. The file format is described on the Online maps page.
Your own tile server
- On the Online tab, tap + → Add custom online map.
- Choose Tile raster (PNG or JPEG tiles) or Mapbox vector tile (MVT) (vector tiles in the OpenMapTiles schema, drawn with your default MBTiles vector style).
- On the General page, enter the Server url, for example
https://tile.example.org/{z}/{x}/{y}.png, and the map’s name. - Close the dialog. The map is in the list; load it.
The address uses placeholders such as {z}, {x}, {y}, {invY} or {-y} (TMS) and {s}.
The full list is on the Online maps page.
For Tile raster maps, the Projection below the server address says how the tiles are cut (see Maps in other projections).
WMS
A WMS (Web Map Service) draws each tile on request. Many national mapping agencies offer one.
- Tap + → Add WMS map.
- Enter the service address (the GetCapabilities URL, e.g.
https://example.org/wms?service=WMS&request=GetCapabilities) under Server url and tap Refresh. The app reads what the service offers. - Choose the WMS version (1.1.1 or 1.3.0), the Layer and its Style.
- Projection: Automatic uses Web Mercator (EPSG:3857) if the layer offers it, else EPSG:4326, else the layer’s own coordinate system, which the app converts on the device. You can also pick one of the layer’s coordinate systems yourself.
- Tap Apply.
When a layer is converted, a note says so. If the app doesn’t know the coordinate system, enter its proj4 definition. If the images come out shifted or mirrored, set the Axis order by hand (Easting first (E, N) or Northing first (N, E); only for WMS 1.3.0).
WMTS
A WMTS (Web Map Tile Service) serves ready-made tiles in one or more tile grids, called tile matrix sets.
- Tap + → Add WMTS map.
- Enter the capabilities address (e.g.
https://example.org/wmts/1.0.0/WMTSCapabilities.xml) under Server url and tap Refresh. - Choose the Layer and Style.
- Choose the tile matrix set in the field Projection. Each entry shows the set’s name and its coordinate system, e.g. “EPSG:2180 (ETRS89 / Poland CS92)”. Prefer a Web Mercator set (EPSG:3857, often called “GoogleMapsCompatible”) when there is one: its tiles are shown as they are.
- Format is shown when the layer offers more than one image format.
- Tap Apply.
A tile matrix set in another coordinate system is converted on the device; a note says so, and the proj4 definition and Axis order fields appear for servers the app can’t read correctly by itself.
Maps in other projections
Most online maps use Web Mercator, the projection of OpenStreetMap and Google Maps. Some don’t, and without the right setting they appear shifted, sometimes by many kilometres. Cartograph Maps handles:
WMS and WMTS in national coordinate systems (e.g. the Polish Geoportal in EPSG:2180, the Estonian Land Board in EPSG:3301): converted on the device, see WMS and WMTS.
Tile maps with a different projection, chosen with Projection on the map’s General page:
- Web Mercator (standard, most maps): the default.
- World Mercator (Yandex).
- China GCJ-02 (Gaode, Tencent, Google China) and China BD-09 (Baidu): Chinese maps use shifted coordinates by law. The app moves their tiles so that they line up with your GPS position and with other maps.
When you type or paste the address of a known server (Yandex, Gaode, Tencent, Google China, Baidu), the app picks the projection itself and says “The projection was chosen from the server’s address.”
National grids (e.g. swisstopo, PDOK): they can’t be recognised from a tile address. Add them as a WMTS map, which reads the grid from the service, or enter the address of the map’s TMS service description (a TileMap document) on the General page and tap Apply: the app takes the tile address and the grid from it.
A map whose grid comes from an .onlinemap file shows From the map definition.
Converted tiles are computed on the device, so the first view of an area takes a little longer; after that they come from the cache.
HTTP headers
Some servers want a key or a particular user agent in every request. Add them on the map’s Advanced page, card Connection, field HTTP Headers, one per line:
User-Agent: MyApp/1.0
X-Api-Key: 0123456789abcdef
A map you add yourself starts with the line User-Agent: Mozilla-C3; change it if the server
asks for a particular one. The headers are stored and synced with the map, and they are sent with
every tile request. The HTTP user agent from the settings (Misc, card Network) is used
only for the other requests: reading WMS/WMTS capabilities, TMS tile map descriptions and
.onlinemap files.
Online map scripts
For servers that need more than a fixed address and headers (a login that returns a temporary token, signed tile addresses, a session cookie), an online map can run JavaScript:
- the Init script runs when the map loads, and again when its result expires or the server answers 401/403. It can return headers for all tile requests;
- the Tile script runs before each tile request (not for tiles from the cache). It can change the tile address and headers.
Scripts are on the map’s Script page (Properties → Script), or come with an .onlinemap
file. They work for tile raster, MVT, WMS and WMTS maps in Web Mercator. They are not applied to
maps converted from another projection, nor to MapLibre maps.
The Script page has:
- Status with Test (runs the scripts once and writes the result into the log; secrets are shortened there) and Clear log. “Ready.” in green means the scripts work.
- Parameters: values you enter for the scripts, such as an API key or a password, so a file
can be shared without your secrets. A parameter is read in a script as
params.<name>. Add one with New parameter → Add. - Init script and Tile script, each with a short help text.
- Log: the scripts’ messages (
console.log) and errors, the last 40 lines.
Before importing a file that contains scripts, the app names the maps with scripts and asks: scripts run inside the app and can send network requests, including the parameter values you enter. Import only files from sources you trust. Maps from the built-in list never have scripts.
Writing scripts
Each script is the body of a function:
| Script | Arguments | Returns (directly or as a Promise) |
|---|---|---|
| Init script | params, state, map | nothing, or { headers, refreshAfter }: headers for every tile request (null removes one); the script runs again after refreshAfter seconds (at least 60). |
| Tile script | tile, params, state, map | nothing (the request goes out as it is), a URL, or { url, headers }. |
tileis{ z, x, y, url, headers };urlis the address the app would request, with the placeholders already filled in.params: the parameter values, as strings (read-only).state: one object per map, shared by both scripts while they run. Keep values and helper functions there.map:{ label, url, headers, minZoom, maxZoom }(read-only).
The engine is roughly ECMAScript 2016: let/const, arrow functions, classes, template strings,
Promise, ?. and ?? work. There is no async/await: chain Promises with .then().
Available functions: fetch(url, options) (GET, POST and others; headers, body, redirect,
timeout), setTimeout/clearTimeout, console.log and friends, btoa/atob,
hash(algorithm, data) and hmac(algorithm, key, data) (md5, sha1, sha256, sha512).
There is no cookie jar: send a cookie with a Cookie header, read cookies with
response.headers.getSetCookie(). There is no file access.
Limits: a script that computes for more than 1 second without a break is stopped; an init script gets 30 seconds in all, a tile script 10 seconds; responses are limited to 8 MB. If the init script fails, tiles are loaded without its headers and it is retried after 1, 2, 4 … up to 30 minutes.
Example, a key in every tile address (tile script):
return tile.url + (tile.url.indexOf('?') < 0 ? '?' : '&') + 'key=' + encodeURIComponent(params.apiKey);
Example, a login that returns a token, renewed every hour (init script):
return fetch('https://example.com/api/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ user: params.user, password: params.password })
}).then(r => {
if (!r.ok) throw new Error('login failed: HTTP ' + r.status);
return { headers: { 'Authorization': 'Bearer ' + r.json().token }, refreshAfter: 3600 };
});
How scripts and parameters are written in an .onlinemap file: Online maps.
A complete example with a login: How to use Strava Heatmaps.
Parameters marked as secret are hidden on screen but not encrypted: they are stored and synced with the map, like its HTTP headers.
Cache
Tiles you have seen are kept on the device, so they load quickly the next time and, in the areas you have viewed, also without a connection. On the map’s Advanced page, card Cache data:
- Cache data: on by default. Turn it off for maps whose tiles change often (weather, traffic).
- Tile cache size: how many tiles are kept (default 100, at most 10000). The tiles used longest ago are removed first.
Reload map (in the map’s options while it is loaded) clears its cached tiles and loads them again, for example after the server updated its map.
The cache is not meant for offline use: it is small and only holds what you happened to look at. For trips without a connection, download the tiles.
Offline use
- Download tiles (map’s menu in the map manager) saves the tiles of an area and a range of zoom levels into an MBTiles file, which then works as an offline map. See Online map tile downloader.
- Download map tiles along track (track menu in the track manager) does the same for a corridor around a track.
- Generate raster map and Create atlas turn a loaded map into an MBTiles file or one large image (see How to convert maps to MBTiles and How to create a map atlas).
These are offered only while Enable tile download is on for the map (Properties → Advanced page, card Connection; on by default). Switch it off for a map whose server doesn’t allow downloads. MapLibre vector maps can’t download tiles; the Strava heatmap has its own option Allow saving tiles for offline use.
Check the terms of the map server before you download many tiles: many services allow viewing but not bulk downloads.
Other options
On the Advanced page of every map: the Zoom card (Zoom limits with Min. zoom and Max. zoom), and on the General page, card Display, the layer Opacity and Blending mode. More about map options: Map manager and Map layers. Offline maps you can use instead: Offline map formats.
Platform differences
Online maps, WMS, WMTS, the projections and scripts work the same on Android, iOS, macOS and Windows. Maps in other projections (WMS, WMTS and tile maps that the app reprojects) line up with OpenStreetMap on every platform, iPhone and Android included.