Layer formats
format picks the format method which creates the Openlayers layer. A layer with an unknown format is skipped with a warning.[1]
format | Data | Requires |
|---|---|---|
wkt, geojson, vector | Features from the XYZ API, WKT or GeoJSON geometry | srid, qID, and a data source or inline features |
cluster | As above, clustered | as above, plus cluster |
mvt | Vector tiles from the XYZ API | table or tables, geom; srid omitted or "3857" |
tiles, maplibre, mapboxStyle, googleMapTiles | Raster tiles and styled basemaps | see 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": 3857as a number skips an MVT layer: the check compares with the string"3857". Vector formats accept a number, but cluster's4326check also compares strings, so write SRIDs as strings.- The devdb cannot create vector tiles. The testhost replaces the
mvttemplate, 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.
{
"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
}
}
}
}