New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next link missing WFS 2.0 getfeature response for specific bbox #6325
Comments
My suspicion of https://lists.osgeo.org/pipermail/mapserver-users/2021-May/082119.html was true So msQueryByRect() starts by issuing a msOGRFileWhichShapes() call equivalent to
This returns 1001 features. But then msQueryByRect() iterate over each feature to an actual intersection test of the geometry with the BBOX (the previous step only tested the intersect of the bounding box of the geometry with the BBOX) .
So the fix is to include the Intersects() test in the initial query |
But is there a way to do true Intersects() from geopackage in any other way than reading the whole table if the resultset must contain exactly 1000 features? Isn't it awfully inefficient? A realistic test should be performed for a layer of one million features or so. |
The request that is issued combine the use of the RTree and Intersects(). I hope this will be efficient:
|
yep, demo Create huge.gpkg ( ~ 90 MB) with
then query only through the RTree:
Combined that with a Intersects() test:
1 ms slower. vs do only a Intersects() test:
Takes more than 1 second |
I try hard to think of something that makes is fail but I can't. So perhaps it is OK.
|
WFS: fix paging with GPKG/Spatialite datasources and non-point geometries (fixes #6325)
Thanks for the quick fix all and @rouault in particular, much appreciated 👍 |
[Backport branch-7-6] WFS: fix paging with GPKG/Spatialite datasources and non-point geometries (fixes #6325)
Hi, I am running into a problem with WFS 2.0 paged GetFeature request. The problem is that for a particular boundingbox a series of paged WFS 2.0 GetFeature requests fails to retrieve all the features. The geometry type of the layer is of
MULTILINESTRING
, the datasource is a GeoPackage file. I also sent an email to the mapserver-users email list regarding this issue.The problem is that the second paged response is missing the next link. The missing next link does actually produces the expected features and contains a next link itself.
In the MapServer logs, when requesting the page with the missing next link, I see the following log output:
msOGRFileNextShape: Returning MS_DONE (no more shapes)
. This log output also shows when requesting the last page of results, of a paged WFS request.The interesting thing is that this behaviour does not occur when requesting a slightly bigger bbox.
The SQL query used by Mapserver when requesting the page with the missing next link is:
This produces 1001 features as expected (other paged requests with more features to come have the same result). So not sure why MapServer decides there are no more results left. The MS_DONE value is returned from here (7.6.2 release) in the MapServer source code.
The problem seems to be caused by an interaction between the data, the requested bbox and a suspected bug in MapServer. In particul in the code that determines if there are any features left in the result set. Btw when changing the datasource to a GeoJSON file this behaviour does not occur, but it does occur with a PostGIS datasource.
I created a repo with a minimal example to reproduce the issue. The repo contains the mapfile, docker-compose, test script, data and a README describing steps in more detail to reproduce the issue.
Tested with MapServer release 7.6.2.
Seems to be related to: #6181
The text was updated successfully, but these errors were encountered: