Skip to content

Layer formats ​

format picks the format method which creates the Openlayers layer. A layer with an unknown format is skipped with a warning.[1]

formatDataRequires
wkt, geojson, vectorFeatures from the XYZ API, WKT or GeoJSON geometrysrid, qID, and a data source or inline features
clusterAs above, clusteredas above, plus cluster
mvtVector tiles from the XYZ APItable or tables, geom; srid omitted or "3857"
tiles, maplibre, mapboxStyle, googleMapTilesRaster tiles and styled basemapssee tile and style formats

Vector formats ​

wkt, geojson, cluster and vector share one format method. Without srid or qID the layer is skipped with a warning.[2] Without a table for the current zoom and without inline features the layer requests nothing. The query template defaults to the format name; params.template replaces it. There is no vector query template, so a vector layer needs params.template. The core wkt, geojson and cluster templates select geom, so they fail without it. featureFormat defaults to format and selects how the response is parsed. fade fades the layer while new data loads. vectorImage renders with an Openlayers VectorImage layer.

MVT ​

MVT layers request tiles through the XYZ API. A missing srid defaults to the string "3857"; any other value, including the number 3857, skips the layer with a warning.[3] Without a table for the current zoom no tile is requested, and the core mvt template selects geom.[4]params.viewport is removed, because the tile defines the extent. cacheSize defaults to 0, no tile cache; transition is the tile fade-in in milliseconds. mvt_cache is ignored with a warning: tile caching is disabled. wkt_properties loads feature properties separately from the tile geometries, so filters and themes update without reloading tiles.

Pitfalls ​

  • "srid": 3857 as a number skips an MVT layer: the check compares with the string "3857". Vector formats accept a number, but cluster's 4326 check also compares strings, so write SRIDs as strings.
  • The devdb cannot create vector tiles. The testhost replaces the mvt template, so MVT examples test the MAPP format, not the core SQL.

Examples ​

A WKT point layer and a GeoJSON polygon layer, both from the devdb.

json
{
  "dbs": "DEVDB",
  "locale": {
    "layers": {
      "points": {
        "display": true,
        "format": "wkt",
        "table": "example.locations",
        "geom": "geom",
        "srid": "4326",
        "qID": "id"
      },
      "polygons": {
        "display": true,
        "format": "geojson",
        "table": "example.features",
        "geom": "geom",
        "srid": "3857",
        "qID": "id",
        "fade": true
      }
    }
  }
}

  1. layer/format/_format.mjs and layer/decorate.mjs ↩︎

  2. layer/format/vector.mjs vector and reload ↩︎

  3. layer/format/mvt.mjs ↩︎

  4. templates/mvt.js ↩︎

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