I want to download a data set from a WFS 2.0 server via HTTP GET, with curl for instance.

$ curl -X GET http://example.com/wfs/?service=WFS&request=GetFeature

The layer is served as GML and contains about 400,000 features. The server limits a response to 100,000 features. CQL is not supported. The GML file contains such a node with each feature:

<gml:Point gml:id="P416" ... >

As far as I understand this id cannot be used to apply paging via a &FILTER parameter.
How can I download the whole data set with curl - maybe with multiple downloads?

2 Answers 2


Often even if filters or pagination are not supported, you can use the BBOX parameter to query features limited to a specific region. Via trial and error this can give you all the data. Just slice the area of interest into BBOXes that return less features than what the WFS is limited to.

For example &BBOX=395000,5815000,400000,5820000 for a part of Berlin in EPSG:25833.

  • Good point. I already considered this. From DescribeFeatureType I found out that there is a spatial_geometry attribute which might be used for the BBOX fitler query. Still I have trouble constructing the correct FILTER parameter for the given WFS version as an (probably urlencoded string) for the HTTP GET request.
    – JJD
    Jul 9, 2015 at 14:28
  • It's really just the URL parameter above: service=WFS&request=GetFeature&version=2.0.0&typeNames=fis:re_strassenbaeume&BBOX=395000,5815000,400000,5820000 Looks safe with 10km tiles here but maybe just use 5km straightaway. Jul 9, 2015 at 14:41
  • 1
    It worked. Thank you. I found several more complicated ways to append a bounding box filter such as with ...<gml:coord><gml:X>... or ...<gml:lowerCorner>... and could not find out which is the proper to be used with WFS 2.0.0. Somehow I missed the simple way.
    – JJD
    Jul 9, 2015 at 16:47

The key section of the WFS spec is Response paging which gives an example:

<GetFeature service="WFS" version="2.0.0" count="100"
  <Query typeNames="cw:MyFeatureType"/>

So for you case you should change the count argument to 100000 (or possibly 99999 - depending on how strict the limit is). The response you get will include a next attribute which is the url of the next request, keep requesting the next urls until you get a response that doesn't have next set, that is the last one.

  • It seems paging is not supported: the GetCapabilities does not advertise ImplementsResultPaging. Nonetheless, I executed the request like this: curl -vX GET http://example.com/wfs/?service=WFS&request=GetFeature&version=2.0.0&typeNames=example:layer&srsName=urn:ogc:def:crs:EPSG:4326&count=100000. The response does not contain a next attribute.
    – JJD
    Jul 9, 2015 at 9:17
  • can you name the service so I can have a play with it
    – Ian Turton
    Jul 9, 2015 at 9:24
  • Here you are. I used EPSG:4326 in my question for simplification.
    – JJD
    Jul 9, 2015 at 9:29
  • 1
    Make multiple requests with different BBOXes. Jul 9, 2015 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.