map0

Configuration

Minimal config

A version number and one basemap are enough to start. Other settings have defaults that you can override as needed.

Defaults in use: this config leaves the view, controls and theme unspecified. The viewer adds zoom, compass, fullscreen, location, globe view, scale bar, attribution, coordinates and print, with a colour scheme that follows the system.

The whole thing

The config above is embedded directly in the page:

minimal.html
<script type="module" src="/map0.js"></script>

<map0-viewer style="height:520px">
  <script type="application/json">
    {
      "version": 1,
      "basemaps": [
        {
          "type": "style",
          "url": "https://mapsneu.wien.gv.at/basemapv/bmapv/3857/resources/styles/root.json"
        }
      ]
    }
  </script>
</map0-viewer>

Three ways to hand over a config, in this order of precedence:

When the config is wrong

The viewer validates the config before rendering. Errors appear in place with the JSON path of the affected setting:

error panel
$.basemaps          at least one basemap is required, e.g. { "type": "style", "url": "…" }
$.layers[2].url     a "wms" layer needs a "url"
$.layers[2].layers  a "wms" layer needs "layers" (WMS LAYERS parameter)