How to show live data with KML NetworkLink overlays
A KML overlay usually comes from a file on your device. With a NetworkLink tag, the file instead tells Cartograph Maps to fetch its content from a server, once or again and again. That way the map can show data that changes: vehicles of a fleet, participants of an event, sensor stations, or points of a database for the area you are looking at.
1. Write the KML file
The file contains one or more NetworkLink tags, each with a Link to your server:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Fleet</name>
<NetworkLink>
<name>Vehicle positions</name>
<Link>
<href>https://fleet.example.com/positions.kml</href>
<viewRefreshMode>onStop</viewRefreshMode>
<viewRefreshTime>2</viewRefreshTime>
<viewFormat>south=[bboxSouth]&west=[bboxWest]&north=[bboxNorth]&east=[bboxEast]</viewFormat>
</Link>
</NetworkLink>
</Document>
</kml>
Your server answers with an ordinary KML document (placemarks with points, lines or polygons).
Supported tags
| Tag | Values | What the app does |
|---|---|---|
href | URL | the address that is loaded |
viewRefreshMode | onStop | loads the data for the visible area each time the map stops moving, at the earliest after viewRefreshTime seconds (at least 2) |
refreshMode | onInterval | loads the data when the overlay is shown, then again every refreshInterval seconds |
viewFormat | text with placeholders | appended to href as its query |
httpQuery | text with placeholders | appended to href as its query, after viewFormat |
If href already contains a query (?…), the app appends viewFormat and httpQuery with &.
Placeholders in viewFormat:
| Placeholder | Replaced by |
|---|---|
[bboxWest], [bboxSouth], [bboxEast], [bboxNorth] | the edges of the visible map area in degrees (the whole world before the map has an area) |
[lookatLon], [lookatLat], [lookatTerrainLon], [lookatTerrainLat], [cameraLon], [cameraLat] | the centre of the visible map area |
[lookatTilt], [lookatHeading], [terrainEnabled] | always 0 (the map is looked at from straight above) |
With onStop and no viewFormat, the app sends
BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth], as Google Earth does.
Placeholders in httpQuery: [clientVersion] (the app version, e.g. 4.1.7), [kmlVersion]
(2.2), [clientName] (CartographMaps) and [language] (the app’s language, e.g. de).
A link with neither viewRefreshMode onStop nor refreshMode onInterval is loaded once,
when the overlay is shown. With both, the interval wins.
Not supported: onExpire, onRequest and onRegion.
The requests carry the app’s HTTP user agent (settings, page Misc), so your server can recognise them.
2. Import it
KML overlays are part of Cartograph Pro.
- Open the overlay manager, tab Overlays.
- Tap + → Import KML/KMZ overlay and choose the file.
- Load the overlay (eye icon). The app loads the data from your server and keeps it up to date while the overlay is shown.
Use Import KML/KMZ overlay, not Import: with Import KML/KMZ files always as bookmarks on, Import turns the file into bookmarks and the links are lost.
To pause the downloads, untick Enable remote KML network links in the overlay’s Properties, or unload the overlay.
Tracks from a KML overlay
Lines of a KML overlay can be pressed like tracks. Save as track in the track popup copies one into the track manager.