Layer tile and style formats
These formats render tiles which the XYZ API does not query. See layer formats for choosing a format.
format | Requires |
|---|---|
tiles | URI |
maplibre | style.URL with accessToken, or an inline style.object |
mapboxStyle | style.URL; accessToken for Mapbox hosted styles |
googleMapTiles | apiKey |
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
maplibrelayer withstyle.URLbut noaccessTokenis skipped: the URL is never fetched. layer.styleof these formats holds no feature styles; see layer style for vector layers.
Examples
A greyscale OpenStreetMap basemap below a devdb point layer.
{
"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"
}
}
}
}