Filtering and Extracting vector dataΒΆ

WFS also defines mechanisms to only retrieve a subset of the data that matches some specified constraints.

  1. Create a new request.xml file in the training root and past the following request into it:

    <wfs:GetFeature xmlns:wfs=''
      xmlns:ogc='' service='WFS' version='1.0.0'>
      <Query typeName='geosolutions:WorldCountries'>
          <ogc:FeatureId fid='WorldCountries.137' />
  2. Go on the command line, move to the training folder root, and execute the request using CURL:

    curl -XPOST -d @request.xml -H "Content-type: application/xml" "http://localhost:8083/geoserver/ows"


    The gdal.bat script can be used to run a prompt with cUrl in its path. Type cd.. to go into the <TRAINING_ROOT> directory.

  3. Now, let’s write an equivalent request - using the name of a state instead of the id- issuing a GET and encoding the filter in a language called CQL. Copy the following URL in your browser’s navigation bar:


    The CQL filter in the Firefox URL bar


    The results of the CQL filter

That’s how a feature set is filtered with either the OGC encoding or the CQL notation.

In the next section we will see how to edit the features via a protocol called WFS Transactional (WFS-T).