WFS: support paging

Description

I was wondering lately how difficult it would be to have Mapserver do paging for WFS requests using a vendor-specific parameter e.g. startposition next to maxfeatures (like the OGC catalog interface). I often limit my requests for OpenLayers? to 100 featurses, but every user asks how do I get the next 100 records .... and now I have to disappoint them.

Tom wrote:
@bart: the next WFS revision (1.2, or 2.0, I can't remember offhand), which will be a joint OGC/ISO IS, will support paging of results.

For now, I agree that a vendor specific parameter would be the way to go in MapServer...filing a ticket is welcome!

I reviewed this bug to be able to take advantage of DB level pagination when it is available.

some notes:
The concept of maxfetures and startindex are passed for the entire wfs request (not per layer). It makes it a bit complicated when we do a query on more that one layer and mix in layers that support pagination and those that do not. Here is what I am proposing for now:

add a startindex element to the layer object (same concept that the already exiting maxfeatutes). If it is set and > 0, layers that can do pagination will use it (at least Oracle and Postgis).

from the wfs perspective

add the ability to verify if a layer supports or not pagination natively

if the wfs request contains only one layer and the layer supports pagination, set the startindex and let the layer use it.

if the wfs request contains more than one layer, let the layers select all features and do the pagination inside msGMLWriteWFSQuery

Is this an acceptable approach?

I will attach the current patch that I have that does what is specified above and uses the pagination for the Oracle driver. Note that the startindex for the first element is 1 in this patch which makes more sense from the user point of view.

I think it would have make sense if the maxfeatures/count and startindex were per layer. But from what I can see in the specs (​http://www.pvretano.com/schemas/wfs/2.0.0/, I am not sure if this is the latest but seems recent), the startindex/count parameters seems to be defined as positive numbers and not as a list (BTW: I saw your post on wms-dev asking this question)
<xsd:attribute name="startIndex" type="xsd:nonNegativeInteger" default="0">
<xsd:attribute name="count" type="xsd:nonNegativeInteger">

You can get the total count of the wfs request (for all layers queried) by using the resulttype parameter. That would allow to do a proper paging. It might be a waste of time in some cases to do a full query to get the count and then do a paging but that is what the spec provides.

Hmm, not sure if this works okay Assefa. I am using maxFeatures=10 and no startIndex, I am getting back only 9 features where I expect 10. There are hundreds in my result set, so this is not what I would expect.

Can you confirm that (for the first issue), if you remove the maxFeatures=5, you receive the full 48 elements. And also that changing the maxFeatures to another number such as 10, you also get a problem.