Web Feature Service

The OpenGISĀ® Web Feature Service (WFS) Interface Standard defines a set of interfaces for accessing geographic information at the feature and feature property level over the Internet. A feature is an abstraction of real world phenomena, that is it is a representation of anything that can be found in the world. The attributes or characteristics of a geographic feature are referred to as feature properties. WFS offer the means to retrieve or query geographic features in a manner independent of the underlying data stores they publish. Where a WFS is authorized to do so, the service can also update or delete geographic features. An instance of a WFS is also able to store queries in order to enable client applications to retrieve or execute the queries at a later point in time (OGC, 2014). The OGC WFS 2.0.0 forms the basis of the ISO 19142 standard.

WFS provides a standard interface for requesting vector geospatial data consisting of geographic features and their properties. The benefit of this is that WFS clients can request source data from multiple WFS servers, and then render the data for display on the client or process the data further as part of a workflow. The standard guarantees that the data can be accessed consistently with other data. Feature properties encoded using common data types such as text strings, date and time can also be accessed consistently.

GetCapabilities Request

Returns metadata about the service, in machine-readable (and human-readable) format. including supported operations and parameters, and a list of the available feature types. 1 shows the parameters of this operation.

Parameters of the WFS GetCapabilities request

ParameterValue Description
SERVICE In this case the value is WFS telling the server which service request is coming.
VERSION Specifies what version of the WFS service specification is being requested, 1.0.01.1.02.0.02.0.2.
REQUEST Tells the WFS server which operation is being requested. In this case, GetCapabilities.

The example below shows how a WFS GetCapabilities request looks like:

https://gip.itc.utwente.nl/services/world_admin?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetCapabilities

Check the response document to see how it describes what the service can do. Besides available data and coordinate systems it also shows which spatial operators are available.

DescribeFeatureType Request

The DescribeFeatureType operation returns a schema description of feature types offered by a WFS instance. The schema descriptions define how a WFS expects feature instances to be encoded on input and how feature instances shall be encoded on output. 1 shows the parameters of this operation.

Parameters of the WFS DescribeFeatureType request

ParameterValue Description
SERVICE In this case the value is WFS telling the server which service request is coming.
VERSION Specifies what version of the WFS service specification is being requested, 1.0.01.1.02.0.02.0.2.
REQUEST Tells the WFS server which operation is being requested. In this case, DescribeFeatureType.
TYPENAMES The name of the feature layer for which a description is requested.

This is an example of a DescribeFeatureType request:

https://gip.itc.utwente.nl/services/world_admin?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=country_borders

GetFeature Request

A WFS server responding to a GetFeature request returns a collection of geographic feature instances filtered according to criteria set by the requesting client. The GetFeature request queries the server with a set of parameters describing the geographic features to return.3 shows the parameters available for this operation.

Parameters of the WFS GetFeature request

ParameterValue Description
SERVICE In this case the value is WFS telling the server which service request is coming.
VERSION Specifies what version of the WFS service specification is being requested, 1.0.01.1.02.0.02.0.2.
REQUEST Tells the WFS server which operation is being requested. In this case, GetFeature.
TYPENAMES Determines the collection of feature instances to return.
BBOX This parameter is a comma-separated list of four numbers that indicate the minimum and maximum bounding coordinates of the feature instances that should be returned.
COUNT Value to limit the number of features in the response.
MAXFATURES Value to limit the response by. Same as COUNT.
FEATUREID Only retrieve the feature with the specified identifier.
FILTER A filter expression based on the OGC Filter Encoding standard, which provides and XML based KVP encoding.

The simplest GetFeature request is one that downloads the feature collection without any constraints to filter the content by. But, since we are dealing with a very large dataset, we will include a filter using the MAXFEATURES parameter. An example of such a request is shown below.

https://gip.itc.utwente.nl/services/world_admin?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=country_borders&MAXFEATURES=1

An extract of the response resulting from the above request is shown in 2. The output formta in this case is the XML, which is the default according to the standard. Notice that the response contains a multipolygon representation and corresponding properties of a country, which name is 'Azerbaijan'. Check how every individual member of the multipolygon has a unique identifier. Try the request in a browser tab and explore the response content.

There is an additional service available for this exercise. Use a GetCapabilities request to determine what data is available via this service. The base URL of the world_features service is:

https://gip.itc.utwente.nl/services/world_features?

Create a GetFeature request to retrieve some of the features of the world_features service.

Additional paraemeters can be added to a GetFeature request to alter the content of the response. The example below uses a bounding box to filter out features and it also specifies a different output format.

https://gip.itc.utwente.nl/services/world_admin?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=country_borders&OUTPUTFORMAT=geojson&BBOX=-25.7,62.7,-12.2,66.9

An excerpt of the response to this request is shown in 3. In this case the format of the response is GeoJSON.

It is also possible to include a query expression in the request via the FILTER parameter. This filter expression is similar to the 'Where' clause in SQL. The filter is specified using a single predicate element, or by combining various predicates using logical operators. Either comparison or spatial operators can be used. The example below shows how the PropertyIsEqualTo operator is used to match a property value against a given literal. Filter encoding falls outside the scope of this exercise. More information can be found through the OGC Standards page. Test this request to see the results.

https://gip.itc.utwente.nl/services/world_admin?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=country_borders&MAXFEATURES=1&OUTPUTFORMAT=geojson&FILTER=<Filter><PropertyIsEqualTo><PropertyName>cntry_name</PropertyName><Literal>Aruba</Literal></PropertyIsEqualTo></Filter>

Construct two separate GetFeature request to retrieve the data of two countries, one in Europe and another one in Africa. Use different filter options for each request.