Web map libraries like MapLibre GL and OpenLayers render vector tiles in the browser. neoserver generates Mapbox Vector Tiles (MVT) from published PostGIS layers and serves them through OGC API Tiles, together with TileJSON for the client. The same layer is also available as rendered PNG, JPEG, or WebP tiles and through WMTS.
What you get
- MVT tiles in the
WebMercatorQuadandWorldCRS84Quadtile matrix sets - Rendered map tiles styled with workspace styles
- TileJSON 3.0 with tile URL templates, bounds, zoom range, and vector layer fields
- WMTS 1.0 for GIS clients that expect it
- One shared cache: a tile generated through OGC API Tiles is reused by WMTS, and the other way around
- An optional persistent cache on the filesystem or S3, with quotas and seeding jobs
In the console
- Publish the layer. Connect PostGIS and publish a table as described in Serve PostGIS as OGC API Features. The published layer becomes a tile source automatically. No separate tile configuration is needed.
- Enable OGC API Tiles and WMTS in the workspace’s service settings. Choose the tile matrix sets, vector and image formats, and whether tiles are public. Tiles must also be enabled on the server (
Tiles.Enabled, orNEOSRV_TILES_ENABLED=true). See Workspace settings. - Style the rendered tiles. The style editor supports SLD and SE, and templates to start from. Attach a style as the layer default. See Styles and map preview.
- Preview the layer as vector tiles or rendered map tiles on the MapLibre map.
- Cache and seed under Operate › Caching. Inspect the tile cache, start seed, reseed, or truncate jobs, and follow their progress.
- Copy the client URL from Endpoints, including the TileJSON address for MapLibre or OpenLayers.
With the API
The same workspace settings can be written through the management API:
curl -X PUT \
http://localhost:9000/api/v1/workspaces/demo/settings/ogc-tiles \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"public": true,
"versions": ["1.0.0"],
"settings": {
"tile_matrix_sets": ["WebMercatorQuad"],
"vector_tiles": { "enabled": true, "formats": ["application/vnd.mapbox-vector-tile"] },
"map_tiles": { "enabled": true, "formats": ["image/png", "image/webp"] },
"cache_enabled": true
}
}'
Server-wide limits on features, vertices, and tile size apply to every request. Workspace values can lower those limits but can’t raise them.
Request tiles
The path order is tileMatrix/tileRow/tileCol, which is the familiar z/y/x:
curl -o tile.mvt \
"http://localhost:9000/workspaces/demo/ogc-tiles/collections/buildings/tiles/WebMercatorQuad/10/343/550"
curl "http://localhost:9000/workspaces/demo/ogc-tiles/collections/buildings/tilejson.json"
Point MapLibre GL, OpenLayers, or any other TileJSON-aware client at the tilejson.json URL. For rendered tiles, use /collections/buildings/map/tiles/... with f=png and an optional style.
Production caching
The persistent tile cache stores tiles on the local filesystem or in an S3-compatible bucket. Quotas can be set per server, workspace, or layer, and updating a layer or service invalidates its tiles.
Related
- OGC API Tiles reference
- WMTS 1.0
- Layer groups to combine layers into one tileset
- Performance and observability