1

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?

1

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: http://geo-solutions.blogspot.co.uk/2011/12/wfs-for-masses-adding-support-for.html


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.

  • 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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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