Skip to content

Layer tile and style formats ​

Workspace Key draft workspace layer mapp format basemap

Keys of the tiles, maplibre, mapboxStyle and googleMapTiles formats, which render raster tiles and styled basemaps; use when adding a basemap.

Resource and sources

These formats render tiles which the XYZ API does not query. See layer formats for choosing a format.

formatRequires
tilesURI
maplibrestyle.URL with accessToken, or an inline style.object
mapboxStylestyle.URL; accessToken for Mapbox hosted styles
googleMapTilesapiKey

Tiles ​

tiles creates a raster tile layer from an Openlayers source, OSM by default, with URI as the tile URL template and params appended as query string. URI is required for every source, including OSM: the URL is URI plus the params, so a missing URI requests undefined…. style.contextFilter applies a CSS filter such as grayscale(100%) to the tile canvas. projection defaults to EPSG:3857.[1]

Mapbox GL styles ​

maplibre renders a maplibre-gl map in a container in the map element. It fetches style.URL only when accessToken is set, and rewrites mapbox: URLs with the token. Without a token it needs the style document inline in style.object; with neither the layer is skipped with a warning.[2] preserveDrawingBuffer keeps the canvas readable for screenshots.

mapboxStyle passes style.URL and accessToken to ol-mapbox-style.[3]

Google map tiles ​

googleMapTiles creates an Openlayers Google source with apiKey. style.mapType defaults to roadmap; style.layerTypes adds overlays such as layerRoadmap.[4]

Pitfalls ​

  • A maplibre layer with style.URL but no accessToken is skipped: the URL is never fetched.
  • layer.style of these formats holds no feature styles; see layer style for vector layers.

Examples ​

A greyscale OpenStreetMap basemap below a devdb point layer.

json
{
  "dbs": "DEVDB",
  "locale": {
    "layers": {
      "OSM": {
        "display": true,
        "format": "tiles",
        "URI": "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
        "style": { "contextFilter": "grayscale(100%)" }
      },
      "points": {
        "display": true,
        "format": "wkt",
        "table": "example.locations",
        "geom": "geom",
        "srid": "4326",
        "qID": "id"
      }
    }
  }
}

  1. layer/format/tiles.mjs ↩︎

  2. layer/format/maplibre.mjs ↩︎

  3. layer/format/mapboxStyle.mjs ↩︎

  4. layer/format/googleMapTiles.mjs ↩︎

XYZ v5.1.0. Generated from knowledge/ at dd7a6fa27736502733499c1bf485f15659b10338. Concepts marked draft are not reviewed.