9

I am running a GetFeature request against a WFS server which does not support to download all data at once. Can I use ogc:PropertyIsGreaterThanOrEqualTo to split the dataset into chunks at download them step by step? I wonder how I can construct the actual URL to include the paging filter. Here is what I tried:

http://example.com/wfs.aspx?request=GetFeature&service=WFS&version=1.1.0 \
&typeName=example:example&maxFeatures=50000 \
&FILTER=<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"> \
<ogc:PropertyIsGreaterThanOrEqualTo><ogc:PropertyName>OBJECTID</ogc:PropertyName> \
<ogc:Literal>50000</ogc:Literal></ogc:PropertyIsGreaterThanOrEqualTo></ogc:Filter>

This is not a valid URI though... That's why uri-encoded the filter part:

http://example.com/wfs.aspx?request=GetFeature&service=WFS&version=1.1.0 \
&typeName=example:example&maxFeatures=50000 \    
&FILTER=%3Cogc%3AFilter%20xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net \
%2Fogc%22%3E%3Cogc%3APropertyIsGreaterThanOrEqualTo%3E%3Cogc%3APropertyName%3EOBJECTID \
%3C%2Fogc%3APropertyName%3E%3Cogc%3ALiteral%3E50000%3C%2Fogc%3ALiteral \
%3E%3C%2Fogc%3APropertyIsGreaterThanOrEqualTo%3E%3C%2Fogc%3AFilter%3E

This actually works. Is there a "nicer" way to do this?

4

I'd like to give an example to GIS-Jonathan's post because I had the same issue with a limited WFS.

In my case all features where provided by adding the "count" and the "startIndex" parameter to the URL.

In case the feature limit was set to 5000, but there are actually 8000 features you can get the missing features by running a request similar to this: (You might need to run more than one request if th limit is very low)

http://www.example.de/mapbender/php/wfs.php?FEATURETYPE_ID=2737&REQUEST=GetFeature&SERVICE=WFS&count=5000&startIndex=5000

Note: Although I often read it works only with WFS 2.0.0, I successfully used it with an WFS that was supposed to be version 1.0.0. So sometimes its worth giving it a try.

1
  • 1
    Not GetCapabilities, that should return no features. GetFeature is the request type needed
    – nmtoken
    Jun 13 '19 at 12:23
2

The WFS 2.0.0 standard includes paging as part of the specification, you may wish to consider using that. See section 7.7.4.4 Response paging of the specification.

That said, I believe GeoServer supports paging via other means for WFS < 2 - Take a look at this: https://www.geosolutionsgroup.com/blog/wfs-for-the-masses-adding-support-for-paging-and-sorting-in-geoserver/


However, to answer your question about URL encoding - I believe you do require this for all GET queries as a result of using the HTTP protocol. I don't think there's a way to make it look pretty I'm afraid.

4
  • I tried the startIndex parameter but it seems it is not supported. I am trying to find out which Geoserver version is running there.
    – JJD
    Feb 18 '14 at 13:17
  • The WFS for masses blog example does not work exactly as written with recent Geoservers. The slight difference is that the first page must be fetched by using &startIndex=0. Request without startIndex does bring features but they can be sorted in a different way and then the second page may not contunue from where the first one ended. Mapserver supports also startIndex for WFS 1.0.0 and 1.1.0.
    – user30184
    May 17 '14 at 9:22
  • 1
    If the WFS server is Geoserver and you know that your application always talks to Geoservers then you can use CQL filters which are much nicer to write docs.geoserver.org/latest/en/user/tutorials/cql/….
    – user30184
    May 17 '14 at 9:31
  • 1
    The link is broken.
    – Dan
    Dec 12 '16 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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