map0

Data sources

WFS

Load vector data from an OGC Web Feature Service by setting the service URL and feature type in the config. map0 sends GetFeature requests, requests GeoJSON and loads WFS 2.0 results in pages. The data is displayed like a GeoJSON layer.

Try it: open the network tab and reload the page. The trees in Alsergrund load in pages of up to 1,000 using count and startIndex, until the reported total is reached. Drinking fountains across Vienna load in one page and are grouped into clusters. Click a feature to view its attributes.

Configuration

Set url and typeNames to identify the service and feature type. map0 builds the GetFeature requests from these settings. Styling, clustering, popups and hover tooltips use the same options as a geojson layer.

wfs.map0.json
{
  "$schema": "https://map0.net/schema/v1.json",
  "version": 1,
  "meta": { "title": "WFS" },
  "map": { "center": [16.359, 48.222], "zoom": 14 },
  "basemaps": [
    {
      "id": "grau",
      "title": "Grey",
      "type": "raster",
      "url": "https://mapsneu.wien.gv.at/basemap/bmapgrau/normal/google3857/{z}/{y}/{x}.png",
      "attribution": "© basemap.at",
      "default": true
    }
  ],
  "layers": [
    {
      "id": "brunnen",
      "type": "wfs",
      "title": "Drinking fountains (clustered)",
      "url": "https://data.wien.gv.at/daten/geo",
      "typeNames": "ogdwien:TRINKBRUNNENOGD",
      "cluster": { "enabled": true, "radius": 45 },
      "style": {
        "circle-color": "#0e7490",
        "circle-radius": 6,
        "circle-stroke-color": "#ffffff",
        "circle-stroke-width": 1.5
      },
      "popup": { "title": "{{BASIS_TYP_TXT}}" },
      "attribution": "Stadt Wien, data.wien.gv.at"
    },
    {
      "id": "baeume-alsergrund",
      "type": "wfs",
      "title": "Tree cadastre, Alsergrund",
      "url": "https://data.wien.gv.at/daten/geo",
      "typeNames": "ogdwien:BAUMKATOGD",
      "params": { "cql_filter": "BEZIRK=9" },
      "pageSize": 1000,
      "style": {
        "circle-color": "#15803d",
        "circle-radius": 4,
        "circle-stroke-color": "#ffffff",
        "circle-stroke-width": 1
      },
      "hover": { "content": "{{GATTUNG_ART}}" },
      "popup": {
        "title": "{{GATTUNG_ART}}",
        "fields": [
          { "key": "PFLANZJAHR_TXT", "label": "Planted" },
          { "key": "BAUMHOEHE_TXT", "label": "Height" },
          { "key": "OBJEKT_STRASSE", "label": "Location" }
        ]
      },
      "attribution": "Stadt Wien, data.wien.gv.at"
    }
  ]
}

What this demo shows

The service must support GeoJSON and CORS. map0 requests application/json in WGS84 by default. Set outputFormat to a GeoJSON format supported by your service, for example "geojson" for MapServer. CORS headers must allow access from your page. With version: "1.1.0", map0 sends a single request using maxFeatures; paging is supported for WFS 2.0.

When to use WFS

WFS is useful when a map should retrieve current data from an existing service. Each reload sends a new request, so changes in the source database become available to the map. Filters such as cql_filter, where supported, restrict the response to the features you need. Request times and data volume depend on the service and query. The default limit of 10,000 caps the number of features loaded. For file-based publishing, consider GeoParquet; for larger datasets, vector tiles such as PMTiles. If your service also provides OGC API Features, you can configure it using a collection URL.