Data sources
OGC API Features
OGC API Features provides vector data as GeoJSON through collection URLs. map0 loads the
data in pages, following the next links in each response.
Try it: open the network tab and reload the page. Around 2,600 railway stations in Great Britain load in pages of 1,000. Each response links to the next page. Hover over a station to see its name. The airports fit in a single page.
Configuration
Set url to the collection URL, such as
…/collections/railwaystation. map0 appends /items and requests
GeoJSON. The layer supports the same style, cluster,
popup and hover options as a geojson layer.
{
"$schema": "https://map0.net/schema/v1.json",
"version": 1,
"meta": { "title": "OGC API Features" },
"map": { "center": [-2.6, 54.0], "zoom": 5.4 },
"basemaps": [
{
"id": "positron",
"title": "OpenFreeMap Positron",
"type": "style",
"url": "https://tiles.openfreemap.org/styles/positron",
"default": true
}
],
"layers": [
{
"id": "bahnhoefe",
"type": "ogcapi-features",
"title": "Railway stations (clustered)",
"url": "https://demo.ldproxy.net/zoomstack/collections/railway_stations",
"pageSize": 1000,
"cluster": { "enabled": true, "radius": 40 },
"style": {
"circle-color": "#0e7490",
"circle-radius": 5,
"circle-stroke-color": "#ffffff",
"circle-stroke-width": 1.5
},
"hover": { "content": "{{name}}" },
"popup": { "title": "{{name}}", "fields": [{ "key": "type", "label": "Type" }] },
"attribution": "OS Open Zoomstack, demo.ldproxy.net"
},
{
"id": "flughaefen",
"type": "ogcapi-features",
"title": "Airports",
"url": "https://demo.ldproxy.net/zoomstack/collections/airports",
"style": {
"circle-color": "#b91c1c",
"circle-radius": 6,
"circle-stroke-color": "#ffffff",
"circle-stroke-width": 1.5
},
"hover": { "content": "{{name}}" },
"popup": { "title": "{{name}}" },
"attribution": "OS Open Zoomstack, demo.ldproxy.net"
}
]
}What this demo shows
-
The collection URL is the only required source setting for an
ogcapi-featureslayer -
map0 follows
nextlinks to load subsequent pages, including when the server returns fewer features per page than requested -
limitcaps the total at 10,000 features by default;pageSizerequests 1,000 features per page by default -
paramsadds query parameters such asbboxanddatetime, orfilterandpropertieswhere the service supports them - Failed requests put the layer into an error state
-
The same styling, clustering, popup, hover and
promoteIdoptions as for GeoJSON
next links rather than
the optional numberMatched count. This demo’s service omits that count.
Loading stops when there is no next link or the configured limit is reached.
The data must use WGS84 longitude/latitude coordinates, the API’s default. The service
must also allow browser access through CORS.
When to use OGC API Features
Like WFS, OGC API Features retrieves current data from a service each time the map loads. Changes in the source database become available on the next reload. Collection URLs and links to subsequent pages make requests straightforward to configure. Request times and data volume depend on the service and the selected features. For data published as a file, GeoParquet can reduce download size. For larger datasets, vector tiles such as PMTiles let the browser load only the parts needed for the current view.