OGC API - Tiles
Modern, RESTful access to tiled web maps in GeoServer. Implements OGC API - Tiles Part 1 (Core) for vector (MVT) and raster (PNG/JPEG) delivery.
Overview
OGC API - Tiles provides a clean, JSON-driven alternative to traditional WMTS. GeoServer implements the specification to deliver pre-tiled and on-the-fly tiles with standardized metadata, open formats, and modern client compatibility.
Key benefits over legacy tile services:
- JSON Metadata: Self-describing endpoints with OpenAPI-like discovery
- Vector Tile Support: Native Mapbox Vector Tiles (MVT) delivery
- CRS Flexibility: EPSG:3857, EPSG:4326, and custom Web Mercator variants
- RESTful Design: Predictable paths, standard HTTP status codes, and caching headers
ogcapi-tiles extension module.
Endpoint Reference
All OGC API - Tiles endpoints are prefixed with /ogcapi/tiles/v1/ by default.
| Path | Method | Description |
|---|---|---|
| /tilesets | GET | List all available tilesets |
| /tilesets/{tileset} | GET | Metadata for a specific tileset |
| /tilesets/{tileset}/tilematrixsets | GET | Supported TileMatrixSet definitions |
| /tilesets/{tileset}/tiles/{z}/{x}/{y} | GET | Retrieve tile at Z/X/Y coordinates |
Query Parameters
format:application/vnd.mapbox-vector-tile,image/png,image/jpegcrs: EPSG code (defaults to 3857)style: Named style identifier from the layer config
Configuration
1. Enable OGC API - Tiles for a Layer Group
- Go to Layer Groups → Edit your target group
- Under OGC API - Tiles Settings, toggle Enable
- Set Tile Matrix Set (WebMercatorQuad is recommended)
- Configure Max Zoom (0–22) and Buffer Size (0–256px)
- Save and apply
2. REST API Configuration
You can also configure tilesets programmatically via GeoServer's REST API:
curl -u admin:geoserver -X POST \
-H "Content-Type: application/json" \
-d '{"tileset":{"name":"roads","format":"mvt","maxzoom":16}}' \
http://localhost:8080/geoserver/ogcapi/tiles/v1/tilesets
Usage Examples
Leaflet + Mapbox Vector Tiles
const tileset = 'roads';
const base = 'http://localhost:8080/geoserver/ogcapi/tiles/v1';
L.vectorGrid.protobuf(
`${base}/tilesets/${tileset}/tiles/{z}/{x}/{y}.mvt`,
{
vectorTileLayerStyles: {
roads: { color: '#00b4d8', weight: 2, opacity: 0.8 }
},
maxZoom: 18
}
).addTo(map);
Python Requests
import requests
url = "http://localhost:8080/geoserver/ogcapi/tiles/v1/tilesets/roads/tiles/10/512/256"
headers = {"Accept": "application/vnd.mapbox-vector-tile"}
resp = requests.get(url, headers=headers)
if resp.status_code == 200:
print("Tile fetched successfully (size: {} bytes)".format(len(resp.content)))
else:
resp.raise_for_status()
OpenAPI / TileJSON Discovery
# TileJSON format
wget http://localhost:8080/geoserver/ogcapi/tiles/v1/tilesets/roads?format=json
# OpenAPI 3.0 spec
wget http://localhost:8080/geoserver/ogcapi/tiles/v1/openapi.json
FAQ & Troubleshooting
Why are my tiles returning 404?
Ensure the layer group has published tiles and the tileset parameter matches the registered name exactly. Check the GeoServer logs for TileMatrixSet mismatches.
How do I enable caching?
GeoServer returns standard Cache-Control headers. For production, place a reverse proxy (Nginx, Cloudflare, or AWS CloudFront) in front of GeoServer and configure tile-specific cache rules.
Can I use custom styles with MVT?
Yes. OGC API - Tiles delivers raw geometry. Styling is applied client-side (Mapbox GL, Deck.gl, or Leaflet.VectorGrid). For server-side raster styling, use format=image/png with a named SLD style.
What about authentication?
Standard GeoServer security applies. Use HTTP Basic, JWT, or OAuth2. Note that public tiles bypass auth if the layer group is set to Public.