Vector maps guide

A practical guide with examples: a map on your page with MapLibre or Mapbox, map styles and label languages, your own layers on the map, 3D buildings, TileJSON and the data version, and the layer contract.

Different base URL. Vector maps live at https://api.elemroot.com: not pump.elemroot.com, where the geo services are.
Contents

Authentication

Style, sprite, TileJSON and tile requests require an API key passed as the query parameter key; query string only (the key cannot be sent in a header or cookie; its position in the query does not matter). Fonts, the layer contract, the changelog and /health require no key. The key must carry the vector-map (tiles) service permission; the orthophoto in the hybrid style also needs the orthophoto (raster) permission. The key may be bound to an origin; then it only works from the allowed web page (the browser sends Origin/Referer).

Use of the services is subject to the terms of use.

...&key=docs_3d4e64fa1755d7299cb78bf6
Demo key. The docs_… key used in the examples is a public demo key for trying things out; the same one as for the geo services (it rotates regularly and is rate-limited). It does not give the orthophoto. For your own application, request a personal key.

The key goes in the style URL only. The style server adds the same key to every Elemroot URL inside the style: TileJSON, tiles, sprite and the hybrid orthophoto. You do not need to configure the key separately in the map library.

Quickstart: a map on a page (MapLibre GL JS)

A complete minimal page: copy, replace the key and open it through a web server (for example python3 -m http.server). Opened directly from a file, the map tiles do not load.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="https://unpkg.com/maplibre-gl@6.11.2/dist/maplibre-gl.css">
  <style> html, body, #map { margin: 0; height: 100%; } </style>
</head>
<body>
  <div id="map"></div>
  <script type="module">
    import * as maplibregl from 'https://unpkg.com/maplibre-gl@6.11.2/dist/maplibre-gl.mjs';

    const map = new maplibregl.Map({
      container: 'map',
      attributionControl: { compact: true },
      style: 'https://api.elemroot.com/styles/v2/daylight/style.json?key=docs_3d4e64fa1755d7299cb78bf6&lang=en',
      center: [24.75, 59.44],   // [longitude, latitude]: Tallinn
      zoom: 10,
      // Rotate and tilt (right mouse button or Ctrl + drag)
      // at an even speed across the whole map
      aroundCenter: false,
      rotateSpeed: 0.4,
      pitchSpeed: -0.4
    });
    map.addControl(new maplibregl.NavigationControl());
  </script>
</body>
</html>

That is all you need: the style itself points to the right tile, sprite and font URLs, and the map credit (© Elemroot) comes from the style. Working example: examples.elemroot.com/vector-map.

Map styles

The style URL contains the style id {style}:

https://api.elemroot.com/styles/v2/{style}/style.json?key=…

All styles use the same vector tiles, so switching the style (map.setStyle(newUrl)) does not reload the tiles. Overview with pictures: Map styles.

IdNameUse
daylightDaylightthe main base map
moonlightMoonlightthe same content in dark colours
hybridHybridorthophoto with roads and names (see hybrid)
heirloomHeirlooma style based on the style of the Elemroot raster map
roundsRoundsa work map for service rounds and larger vehicles
rounds_nightRounds Nightthe same work map in dark colours
data_lightData Lighta quiet background for your own data layers
data_darkData Darkthe same in dark colours
winterWintera winter base map in light snowy colours
christmasChristmasa dark holiday-season base map in Christmas colours

Load the style from our URL, not as a copy from your own server: then style fixes and new data reach the map on their own. You can adjust the style in code (map.setPaintProperty, map.setLayoutProperty). The styles have no initial view: set center and zoom yourself.

Labels in seven languages

The language of place names is chosen with the lang parameter in the style URL: et Estonian (default), en English, ru Russian, lv Latvian, lt Lithuanian, fi Finnish, de German. An unknown value gives the Estonian style.

style: 'https://api.elemroot.com/styles/v2/daylight/style.json?key=docs_3d4e64fa1755d7299cb78bf6&lang=en'

To switch the language, load the same style with another language: map.setStyle('…/style.json?key=…&lang=lv'); the tiles are not reloaded. If an object has no name in the chosen language, the local name is shown. Street names, road numbers and house numbers are in their local form in every language.

Mapbox GL JS and mobile SDKs

Every style has a variant mapbox.json for the Mapbox libraries (same URL, different file name):

https://api.elemroot.com/styles/v2/{style}/mapbox.json?key=…&lang=…

The content is the same; in addition it has the layer slots (slot) bottom (above land cover and buildings, below roads), middle (above roads and boundaries, below labels) and top (on top of everything), for placing your own layer in the right spot.

<link rel="stylesheet" href="https://unpkg.com/mapbox-gl@3.33.0/dist/mapbox-gl.css">
<script src="https://unpkg.com/mapbox-gl@3.33.0/dist/mapbox-gl.js"></script>
<div id="map" style="height: 400px"></div>
<script>
  mapboxgl.accessToken = 'YOUR_MAPBOX_TOKEN';   // the Mapbox library requires a Mapbox token
  const map = new mapboxgl.Map({
    container: 'map',
    style: 'https://api.elemroot.com/styles/v2/daylight/mapbox.json?key=docs_3d4e64fa1755d7299cb78bf6&lang=en',
    center: [24.75, 59.44],
    zoom: 10
  });
  map.on('load', () => {
    map.addSource('points', { type: 'geojson', data: {
      type: 'Feature', geometry: { type: 'Point', coordinates: [24.75, 59.44] } } });
    map.addLayer({ id: 'points', type: 'circle', source: 'points', slot: 'middle',
      paint: { 'circle-radius': 8, 'circle-color': '#d9480f' } });
  });
</script>
Mapbox token. The Mapbox libraries (Mapbox GL JS, Mapbox Maps SDK and Navigation SDK) require Mapbox's own access token; without it the map is not drawn. The Elemroot key goes in the style URL only.

In mobile apps, pass the style URL as the style URI: Mapbox Maps SDK and Navigation SDK (iOS, Android) use the mapbox.json URL, MapLibre Native (iOS, Android) the style.json URL.

Hybrid: orthophoto with roads and names

The style hybrid (Hybrid) shows the orthophoto with roads, boundaries and names. The orthophoto covers Estonia, Latvia and Lithuania; its credit comes from the style and is shown below the map.

style: 'https://api.elemroot.com/styles/v2/hybrid/style.json?key=YOUR_KEY'

Besides the vector-map (tiles) permission, the key needs the orthophoto (raster) permission. Without it the vector layer loads as usual, but the orthophoto tiles return 403 and a dark background is shown instead of the orthophoto. The demo key does not give the orthophoto.

Your own layers on the map

Every style has metadata["elemroot:before_id"]: the layer below which your own data fits. Your layers then stay above roads and boundaries, while place names stay on top and readable.

map.on('load', () => {
  const beforeId = map.getStyle().metadata['elemroot:before_id'];
  map.addSource('my-areas', { type: 'geojson', data: '/my-areas.geojson' });
  map.addLayer({
    id: 'my-areas', type: 'fill', source: 'my-areas',
    paint: { 'fill-color': '#d9480f', 'fill-opacity': 0.4 }
  }, beforeId);
});

Read the layer id from the style, do not hard-code it: it may differ between styles. Switching the style with setStyle removes your own layers; add them again after the switch.

Ready-made data layers on top of the map, such as cadastral parcels: Overlays.

3D buildings

The building layer building has the fields height (height of the top above ground, in metres) and min_height (height of the bottom, for example on an overhanging building part; absent means 0). Buildings are in the detail area from z13. The styles have ready-made 3D layers that are hidden by default. Usually it is one layer, building-3d. The styles winter and christmas have several 3D layers, marked in metadata with "elemroot:toggle": "building-3d". Switch them all at once:

function set3D(map, on) {
  const style = map.getStyle();
  const show = (id, visible) => map.setLayoutProperty(id, 'visibility', visible ? 'visible' : 'none');
  for (const layer of style.layers) {
    const mark = layer.metadata && layer.metadata['elemroot:toggle'];
    if (layer.id === 'building-3d' || mark === 'building-3d') show(layer.id, on);
  }
  // House numbers: on the roof in 3D, on the ground otherwise
  const hn = style.metadata && style.metadata['elemroot:housenumber_3d'];
  if (hn && hn.switch === 'app-visibility' && map.getLayer(hn.flat) && map.getLayer(hn.roof)) {
    show(hn.flat, !on);
    show(hn.roof, on);
  }
}

set3D(map, true);
map.easeTo({ pitch: 60, zoom: 16 });

If the style metadata has the key elemroot:housenumber_3d, house numbers have two layers: flat shows the numbers on the ground and roof at the height of the building roof. Only one of them should be visible at a time. In a style without 3D layers the function does nothing. Call the function again after changing the style (setStyle).

3D buildings with your own design:

map.addLayer({
  id: 'buildings-3d', type: 'fill-extrusion',
  source: 'elemroot', 'source-layer': 'building',
  filter: ['all', ['!=', ['get', 'kind'], 'underground'], ['!', ['has', 'has_parts']]],
  paint: {
    'fill-extrusion-color': '#c8ccd1',
    'fill-extrusion-height': ['coalesce', ['get', 'height'], 3],
    'fill-extrusion-base': ['coalesce', ['get', 'min_height'], 0],
    'fill-extrusion-opacity': 0.9
  }
}, map.getStyle().metadata['elemroot:before_id']);

A building made of parts (has_parts) has its parts as separate objects (is_part), each with its own height. The filter leaves out the whole outline so that the parts do not overlap. Working example: 3D buildings.

Patterned 3D walls on iPhone and iPad

MapLibre GL JS sometimes draws patterned 3D buildings incorrectly on iPhone and iPad: light patches appear on the walls while the map is rotated. Of the Elemroot styles, christmas has patterned 3D walls. Other styles are not affected.

If you wish, you can use MapLibre GL JS 6.11.2 with this fixed: maplibre-gl-6.11.2-elemroot.1.zip (0.3 MB). Unpack the archive, copy the four files in dist to one folder on your server and load MapLibre from there:

<link rel="stylesheet" href="/maplibre/maplibre-gl.css">
<script type="module">
  import * as maplibregl from '/maplibre/maplibre-gl.mjs';
  // continue as in the quick start
</script>

Using it is optional: all Elemroot styles also work with standard MapLibre GL JS. The archive includes a guide, the MapLibre license and a script that applies the same change to the package installed from npm. This is not an official MapLibre release.

TileJSON and your own style

All styles use one source, elemroot. Its description (TileJSON 3.0.0) is at /tiles/v2/elemroot-v2.json:

Request
curl "https://api.elemroot.com/tiles/v2/elemroot-v2.json?key=docs_3d4e64fa1755d7299cb78bf6"
FieldContent
tilestile URL template with the data version and your key
minzoom, maxzoom0 and 15
vector_layerslayers and their fields
elemroot:data_versiondata version (see data version)
elemroot:languageslabel languages
elemroot:detail_boundsbounds of the detail area (the Baltics and neighbouring areas)
elemroot:contract_url, elemroot:changelog_urllayer contract and changelog (see contract)

In your own style, refer to the source like this:

"sources": {
  "elemroot": {
    "type": "vector",
    "url": "https://api.elemroot.com/tiles/v2/elemroot-v2.json?key=YOUR_KEY"
  }
},
"glyphs": "https://api.elemroot.com/fonts/{fontstack}/{range}.pbf"

The source name elemroot is the same as in our styles, so you can copy their layers into your style. When building your own style, keep the map credit © Elemroot (the TileJSON attribution).

Data version

Every data update gets a new data version (the TileJSON field elemroot:data_version). The tiles have a separate URL for each data version and never change, so browsers and caches can keep them for a long time. The style and elemroot-v2.json always point to the current data version: new data reaches the map on its own.

URLContent
/tiles/v2/elemroot-v2.json?key=…current data version
/tiles/v2/elemroot-v2/{version}.json?key=…a specific data version
/tiles/v2/elemroot-v2/{version}/{z}/{x}/{y}.mvt?key=…tiles of that data version

The server keeps the three latest data versions; URLs of an older version return 404. A specific version URL suits a map that has to stay unchanged for a while. Otherwise use the unversioned elemroot-v2.json URL.

Layers, contract and changelog

LayerContentZoom in the detail areaZoom elsewhere
waterWater areas: sea, lakes, river and canal areas0–150–11
waterwayWaterways as lines: rivers, streams, canals, ditches5–153–11
landcoverLand cover: forest, scrub, wetland, farmland and grassland, sand, rock, ice0–150–11
landuseLand use: residential, industrial and commercial areas, cemeteries, parks etc.5–155–11
protected_areaProtected areas6–156–11
boundaryCountry and administrative boundaries0–150–11
admin_areaAdministrative areas: countries, in the Baltics also counties and municipalities0–150–11
placePlace names: countries, administrative units, settlements and districts0–150–11
natural_labelNatural names: seas, bays, islands, lakes etc.0–150–11
transportRoads, cycle and footways, railways and ferry lines4–154–11
transport_labelRoad names and road numbers6–156–11
buildingBuildings (height, min_height)13–15–
addressHouse numbers and farm and house names14–15–
poiPoints of interest6–1510–11
aerowayAerodromes, runways and taxiways9–1510–11
aeroway_labelAerodrome names6–156–11
structureStructures: quays, piers, dams, towers etc.12–15–

The detail area is the Baltics with neighbouring areas (elemroot:detail_bounds). The exact description (layers, fields, types, allowed values and zooms) is in the layer contract; changes to the contract (a new layer, field or value) are in the changelog. Both exist for each data version, need no key and are in Estonian and English:

https://api.elemroot.com/tiles/v2/elemroot-v2/{version}/contract_vector_layers.json
https://api.elemroot.com/tiles/v2/elemroot-v2/{version}/changelog.json

The URLs for the current data version are in the TileJSON (elemroot:contract_url, elemroot:changelog_url).

Using tiles directly

A single tile is a gzip-compressed Mapbox Vector Tile (protobuf) in the XYZ scheme, Web Mercator (EPSG:3857). Usually the map library requests them itself; for a manual check:

curl -s --compressed -o tile.mvt -w "%{http_code} %{content_type}\n" \
  "https://api.elemroot.com/tiles/v2/elemroot-v2/10/584/305.mvt?key=docs_3d4e64fa1755d7299cb78bf6"

The unversioned URL /tiles/v2/elemroot-v2/{z}/{x}/{y}.mvt returns the tile of the current data version and suits clients that do not read TileJSON (for example QGIS). Map libraries use the URL with the data version from the TileJSON.

The response content type is application/x-protobuf and the tile is always gzip-compressed (Content-Encoding: gzip); map libraries decompress it themselves, when saving by hand use --compressed. There is data for the whole world at z0–11 and in the detail area at z0–15; above z15 the map library scales up the z15 tile. Outside the detail area the z12–15 tiles are empty. An empty tile returns 204 No Content: this is normal, not an error. An x/y value above 2z−1 wraps around (mod 2z); z above 15 returns 404.

Sprites and fonts

Every style has its own sprite (map symbols and patterns): /styles/v2/sprite/{style}.json and .png, high resolution {style}@2x.json and @2x.png (with key). The style refers to it itself.

To show place names the map library loads font files (glyph PBF) with the pattern /fonts/{fontstack}/{range}.pbf (no key, ranges in steps of 256). Our styles use the fonts Noto Sans, Noto Serif and Barlow Condensed.

curl -s -o glyphs.pbf "https://api.elemroot.com/fonts/Noto%20Sans%20Regular/0-255.pbf"

Exactly these fontstacks are available:

FontFontstacks
ArialArial Bold · Arial Regular
Arial Unicode MSArial Unicode MS Regular
Barlow CondensedBarlow Condensed Bold · Barlow Condensed Bold,Noto Sans Bold · Barlow Condensed Medium · Barlow Condensed Medium,Noto Sans Medium · Barlow Condensed Regular · Barlow Condensed Regular,Noto Sans Regular · Barlow Condensed SemiBold · Barlow Condensed SemiBold,Noto Sans SemiBold
CambriaCambria Bold Italic
Fira SansFira Sans Bold · Fira Sans Italic · Fira Sans Medium · Fira Sans Regular · Fira Sans SemiBold
Fira Sans CondensedFira Sans Condensed Bold · Fira Sans Condensed Medium · Fira Sans Condensed Regular · Fira Sans Condensed SemiBold
IBM Plex SansIBM Plex Sans Bold · IBM Plex Sans Italic · IBM Plex Sans Medium · IBM Plex Sans Regular · IBM Plex Sans SemiBold
IBM Plex Sans CondensedIBM Plex Sans Condensed Regular · IBM Plex Sans Condensed SemiBold
InterInter Bold · Inter Medium · Inter Regular · Inter SemiBold
MerriweatherMerriweather Bold · Merriweather Italic · Merriweather Regular
MontserratMontserrat Bold · Montserrat Medium · Montserrat Regular · Montserrat SemiBold
Noto SansNoto Sans Bold · Noto Sans Bold Italic · Noto Sans Italic · Noto Sans Medium · Noto Sans Regular · Noto Sans SemiBold
Noto Sans CondensedNoto Sans Condensed · Noto Sans Condensed Bold · Noto Sans Condensed Medium · Noto Sans Condensed Regular
Noto SerifNoto Serif Bold · Noto Serif Bold Italic · Noto Serif Italic · Noto Serif Regular
Open SansOpen Sans Bold · Open Sans Italic · Open Sans Regular · Open Sans Regular,Arial Unicode MS Regular · Open Sans Semibold · Open Sans SemiBold Italic
OverpassOverpass Bold · Overpass Regular · Overpass SemiBold
PT SansPT Sans Bold · PT Sans Italic · PT Sans Regular
PT Sans NarrowPT Sans Narrow Bold · PT Sans Narrow Regular
RobotoRoboto Bold · Roboto Bold,Noto Sans Bold · Roboto Italic · Roboto Italic,Noto Sans Italic · Roboto Medium · Roboto Medium,Noto Sans Regular · Roboto Regular · Roboto Regular,Noto Sans Regular
Roboto CondensedRoboto Condensed Bold · Roboto Condensed Italic · Roboto Condensed Regular
Source Sans 3Source Sans 3 Bold · Source Sans 3 Italic · Source Sans 3 Regular · Source Sans 3 Semibold
UbuntuUbuntu Bold · Ubuntu Italic · Ubuntu Medium · Ubuntu Medium Italic · Ubuntu Regular · Ubuntu Regular Italic
VerdanaVerdana Bold · Verdana Bold Italic · Verdana Italic · Verdana Regular
In your own style use one of the above as the text-font value. A comma stack (e.g. ["Barlow Condensed SemiBold", "Noto Sans SemiBold"]) works only if it is in the list: the server does not compose fonts on the fly, any other combination returns 404 and the labels disappear from the map. Ranges come only in steps of 256 (0-255, 256-511 …).

QGIS and other desktop clients

QGIS (3.14+): Browser → Vector Tiles → New Generic Connection:

FieldValue
URLhttps://api.elemroot.com/tiles/v2/elemroot-v2/{z}/{x}/{y}.mvt?key=YOUR_KEY
Min/Max zoom0 / 15
Style URL (optional)https://api.elemroot.com/styles/v2/daylight/style.json?key=YOUR_KEY

Parameters

* = required. The key key (query) is required everywhere except fonts, the contract, the changelog and /health: see authentication.

Style: /styles/v2/{style}/style.json and mapbox.json

ParamMeaningPossible values / exampleDefault
{style} *Style iddaylight, moonlight, hybrid, heirloom, rounds, rounds_night, data_light, data_dark, winter, christmas; unknown → 404—
langLabel languageet, en, ru, lv, lt, fi, de; unknown → etet

Tiles: /tiles/v2/elemroot-v2/{version}/{z}/{x}/{y}.mvt

ParamMeaningPossible values / exampleDefault
{version}Data version (from the TileJSON); absent in the unversioned URLone of the three latest; older → 404current
{z} *Zoom level0…15; higher → 404—
{x} *Tile column (XYZ)0…2^z−1 (larger wraps around)—
{y} *Tile row (XYZ)0…2^z−1 (larger wraps around)—

Fonts: /fonts/{fontstack}/{range}.pbf

ParamMeaningPossible values / exampleDefault
{fontstack} *Fontstack: exactly one of the available ones (URL-encoded)Noto Sans Regular, Barlow Condensed SemiBold,Noto Sans SemiBold …; any other combination → 404—
{range} *Unicode range in steps of 2560-255, 256-511 … 65280-65535; any other split → 404—

When to use what

Common tasks and the matching endpoint.

TaskCombinationWhy
A map on a page with minimal effortready-made style /styles/v2/daylight/style.json?key=… in MapLibretile, sprite and font URLs and the key come with the style
Another look or label languageanother style id and lang in the URL, switch with setStyleall styles use the same tiles
Your own data on the mapaddLayer(layer, metadata['elemroot:before_id'])place names stay on top
Mapbox GL JS or a Mapbox mobile SDK/styles/v2/{style}/mapbox.json?key=… + Mapbox tokenlayer slots bottom, middle, top
Orthophoto with roads and namesstyle hybrid, key also with the raster permissionthe orthophoto credit comes from the style
Your own designTileJSON /tiles/v2/elemroot-v2.json?key=… as the style source.url + your own layerslayers and fields from vector_layers and the contract
QGIS or another desktop clientunversioned tile URL /tiles/v2/elemroot-v2/{z}/{x}/{y}.mvtsee QGIS
L-EST97 grid, ready-made images or a client without WebGLraster mapsvector maps are EPSG:3857 and need WebGL
Seven pitfalls. (1) The key goes in the query string only; a header or cookie does not count. (2) The hybrid orthophoto needs the raster permission on the key; without it only the orthophoto tiles return 403. (3) text-font must be an available fontstack, otherwise the labels silently disappear. (4) Read elemroot:before_id from the style; it may differ between styles. (5) A specific data version URL works while it is among the three latest. (6) Tiles are always gzip-compressed: use --compressed when saving by hand. (7) 204 is not an error but an empty spot.

Caching and CORS

ResourceCache-Control
Tiles at a data version URLpublic, max-age=31536000, immutable
Tiles at the unversioned URLpublic, max-age=86400 (24 h)
Style, TileJSON, spritespublic, max-age=3600 (1 h)
Layer contract, changelogpublic, max-age=31536000, immutable
Fontspublic, max-age=604800 (7 days)

All responses come with the header Access-Control-Allow-Origin: *; the map can be put on any web page. On tiles the header is added in response to the browser's Origin header (Vary: Origin); in a browser it is always present, with curl without Origin the header does not show and that is not an error.

Error handling

CodeMeaning
403Wrong or missing key: body {"error":"invalid_api_key"}. The same response comes with an expired key, when the key lacks the vector-map (tiles) service permission, when an origin-bound key is used outside the allowed page, and on the hybrid orthophoto tiles when the key lacks the orthophoto (raster) permission
204Empty tile (no data): normal
404z above 15 (Tile not found, text); unknown data version or style; unknown path → JSON {"error":"not_found"}. Note: x/y out of range does not give 404 (see using tiles directly)
429Too many requests (the demo key is rate-limited): Too Many Requests, HTML body
Map empty or grey? Check in the browser console whether the tile requests get 403 (key missing or wrong) and whether the style URL contains ?key=….

Next

Map styles → All styles with pictures. Overlays → Cadastral parcels on top of the vector map. API reference (Swagger UI) → All endpoints and “try it out”.