← Back to Blog

What is WFS? Guide to Web Feature Service

Learn what WFS (Web Feature Service) is, how it works, and how to use GeoDataTools to easily query, filter, and retrieve geospatial vector feature data.

What is WFS (Web Feature Service)?

WFS, or Web Feature Service, is an open standard published by the Open Geospatial Consortium (OGC) that defines an interface for requesting and manipulating geographic vector features over the web. Unlike image-based map services, WFS returns the actual feature data — points, lines, and polygons — along with their attribute information. This makes WFS essential for applications that need to query, analyze, or edit geospatial data rather than simply display a rendered map image.

With WFS, a client sends standard HTTP requests to a server and receives structured geographic data in return. The default response format is GML (Geography Markup Language), but many modern servers also support GeoJSON and other formats. You can try working with WFS outputs directly in GeoDataTools to convert and inspect the data you retrieve.

WFS as an OGC Standard

The OGC first published the WFS specification in 2002 as version 1.0.0. It has since evolved through several revisions:

  • WFS 1.0.0 (2002) — Initial release defining core read operations.
  • WFS 1.1.0 (2005) — Added support for spatial reference system negotiation and improved filter capabilities.
  • WFS 2.0.0 (2010) — Introduced stored queries, response paging, and alignment with ISO 19142.
  • OGC API — Features (2019) — A modernized RESTful successor that uses JSON and OpenAPI, gradually replacing traditional WFS.

The full standard is maintained at the OGC WFS specification page. Major server implementations such as GeoServer, MapServer, and deegree all comply with these versions.

How WFS Differs from WMS

WFS and WMS are both OGC standards for serving geospatial data, but they serve fundamentally different purposes. WMS returns pre-rendered map images, while WFS returns raw vector features with their geometry and attributes. For a deeper comparison, see WFS vs WMS Explained.

Aspect WFS WMS
Response type Vector features (GML, GeoJSON) Raster images (PNG, JPEG)
Primary use case Data query, analysis, editing Map visualization
Attribute access Full attribute data returned Limited (GetFeatureInfo only)
Editing support Yes (WFS-T) No
Client-side styling Yes — data styled locally No — server controls rendering
Bandwidth usage Higher (raw geometry data) Lower (compressed images)

Core WFS Operations

A WFS server exposes several standard operations. The three most important are GetCapabilities, DescribeFeatureType, and GetFeature.

GetCapabilities

The GetCapabilities request returns an XML document describing the server's available layers, supported operations, coordinate reference systems, and output formats. This is always the first request a client makes when connecting to a WFS endpoint.

https://example.com/wfs?service=WFS&version=2.0.0&request=GetCapabilities

The response lists every feature type the server publishes, along with metadata such as bounding boxes and supported filters.

DescribeFeatureType

The DescribeFeatureType operation returns the schema (structure) of a specific feature type. It tells you which attributes exist, their data types, and whether geometry is a point, line, or polygon.

https://example.com/wfs?service=WFS&version=2.0.0&request=DescribeFeatureType&typeName=roads

This is useful for building dynamic forms or understanding the data before issuing a GetFeature query.

GetFeature

The GetFeature operation retrieves actual feature data from the server. You can filter results by bounding box, attribute values, or spatial relationships. Here is an example that fetches features with a CQL filter:

https://example.com/wfs?service=WFS&version=2.0.0&request=GetFeature&typeName=buildings&CQL_FILTER=height>50&outputFormat=application/json

This request returns all building features where the height attribute exceeds 50, formatted as GeoJSON.

GML: The Default Output Format

GML (Geography Markup Language) is an XML-based encoding for geographic features and the default response format for WFS. It is highly expressive and supports complex feature models, nested properties, and multiple geometry types. However, GML can be verbose and harder to parse in web applications compared to lighter formats like GeoJSON.

Most WFS servers allow you to specify an alternative output format via the outputFormat parameter. For web development, requesting application/json (GeoJSON) is usually more practical. You can convert between GML and other formats using the GeoDataTools converter.

Getting GeoJSON Output from WFS Servers

Many modern WFS servers — including GeoServer, MapServer, and QGIS Server — support GeoJSON as an output format. To request GeoJSON instead of GML, append outputFormat=application/json to your GetFeature request:

https://example.com/wfs?service=WFS&version=2.0.0&request=GetFeature&typeName=parks&outputFormat=application/json&maxFeatures=3

The response is a standard GeoJSON FeatureCollection conforming to RFC 7946:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-73.9857, 40.7484]
      },
      "properties": {
        "name": "Central Park",
        "area_ha": 341
      }
    }
  ]
}

GeoJSON is lightweight, natively supported by JavaScript, and compatible with libraries like Leaflet, Mapbox GL JS, and OpenLayers. For a full overview of the format, read What is GeoJSON?

WFS-T: Transactional WFS

WFS-T (Transactional Web Feature Service) extends the base WFS specification with write operations. While standard WFS is read-only, WFS-T allows clients to modify data on the server through three additional operations:

  • Insert — Create new features by sending geometry and attribute data to the server.
  • Update — Modify the attributes or geometry of existing features, identified by a filter or feature ID.
  • Delete — Remove features from the server dataset using a filter expression.

WFS-T is commonly used in collaborative GIS environments where field teams or analysts need to edit shared datasets through a central server. GeoServer supports WFS-T out of the box when a data store is configured as writable.

Because WFS-T exposes write access, servers should enforce authentication and authorization to prevent unauthorized modifications.

Using WFS in QGIS

QGIS provides built-in support for connecting to WFS endpoints. To add a WFS layer:

  • Open QGIS and go to Layer → Add Layer → Add WFS Layer.
  • Click New to create a connection and enter the WFS endpoint URL (e.g., https://example.com/wfs).
  • Click Connect to retrieve the list of available feature types.
  • Select the layer you want and click Add.

QGIS sends a GetCapabilities request behind the scenes, then issues GetFeature requests as you pan and zoom. You can also apply server-side filters to limit the data transferred. If the server supports WFS-T, QGIS allows you to toggle editing mode and push changes back to the server.

Using WFS in Web Applications

Consuming WFS data in a web application is straightforward when the server supports GeoJSON output. Use the browser's fetch() API to request features and render them on a map:

const wfsUrl =
  'https://example.com/wfs?' +
  'service=WFS&version=2.0.0&request=GetFeature' +
  '&typeName=parks&outputFormat=application/json' +
  '&maxFeatures=100';

fetch(wfsUrl)
  .then(response => response.json())
  .then(geojson => {
    console.log('Features loaded:', geojson.features.length);
    // Add geojson to your map layer (Leaflet, Mapbox, OpenLayers)
  })
  .catch(error => {
    console.error('WFS request failed:', error);
  });

Keep the following in mind when working with WFS in the browser:

  • CORS — The WFS server must include appropriate CORS headers, or you will need a proxy.
  • Pagination — Use maxFeatures (WFS 1.x) or count (WFS 2.0) to limit response size and implement paging with startIndex.
  • CQL filters — Send server-side filters to reduce payload size instead of filtering client-side.

FAQ

What is the difference between WFS and WMS?

WFS returns raw vector feature data (geometry and attributes) in formats like GML or GeoJSON, enabling clients to query, style, and edit the data. WMS returns pre-rendered map images (PNG, JPEG) that the client displays as tiles or overlays. Use WFS when you need access to the underlying data; use WMS when you only need a visual map layer. See WFS vs WMS Explained for a full comparison.

Can WFS return GeoJSON instead of GML?

Yes. Most modern WFS servers support GeoJSON as an output format. Add outputFormat=application/json to your GetFeature request. GeoJSON is lighter than GML and natively parseable in JavaScript, making it the preferred choice for web applications. The output conforms to RFC 7946.

What is WFS-T and when should I use it?

WFS-T (Transactional WFS) extends WFS with insert, update, and delete operations, allowing clients to write data back to the server. Use WFS-T when multiple users or applications need to collaboratively edit a shared geospatial dataset through a central server. Ensure the server enforces authentication and access control to protect data integrity.

Ready to work with your geospatial data?

Visualize, filter, and convert GeoJSON and KML files directly in your browser.

Try GeoDataTools