Hi all,

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. Running on version 
7.6.2.

The problem is that the second paged response 
(https://geodata.nationaalgeoregister.nl/rioned/gwsw/wfs/v1_0?SERVICE=WFS&SERVICE=WFS&version=2.0.0&service=wfs&request=Getfeature&bbox=80034.6,452005.1,81976.8,453965.8&outputformat=gml3&srsname=EPSG%3A28992&typename=gwsw%3Abeheer_leiding&STARTINDEX=1000
 ) is missing the next link. The missing next link does actually produces the 
expected features 
(https://geodata.nationaalgeoregister.nl/rioned/gwsw/wfs/v1_0?SERVICE=WFS&SERVICE=WFS&version=2.0.0&service=wfs&request=Getfeature&bbox=80034.6,452005.1,81976.8,453965.8&outputformat=gml3&srsname=EPSG%3A28992&typename=gwsw%3Abeheer_leiding&STARTINDEX=2000
 ) 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: 
https://geodata.nationaalgeoregister.nl/rioned/gwsw/wfs/v1_0?SERVICE=WFS&SERVICE=WFS&version=2.0.0&service=wfs&request=Getfeature&bbox=80034.6%2C452005.1%2C81976.8%2C453965.8&outputformat=gml3&srsname=EPSG%3A28992&typename=gwsw%3Abeheer_leiding

The SQL query used by Mapserver when requesting the page 
(https://geodata.nationaalgeoregister.nl/rioned/gwsw/wfs/v1_0?SERVICE=WFS&SERVICE=WFS&version=2.0.0&service=wfs&request=Getfeature&bbox=80034.6,452005.1,81976.8,453965.8&outputformat=gml3&srsname=EPSG%3A28992&typename=gwsw%3Abeheer_leiding&STARTINDEX=1000
 ) with the missing next link is:

```
SELECT "beheer_leiding"."uri" AS "uri", "beheer_leiding"."geometry" AS 
"geometry" FROM "beheer_leiding" JOIN "rtree_beheer_leiding_geometry" 
ms_spat_idx ON "beheer_leiding".ROWID = ms_spat_idx.id AND ms_spat_idx.minx <= 
81976.8 AND ms_spat_idx.maxx >= 80034.6 AND ms_spat_idx.miny <= 453965.8 AND 
ms_spat_idx.maxy >= 452005.1  ORDER BY "beheer_leiding".ROWID LIMIT 1001 OFFSET 
1000
```

This query actually 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<https://github.com/MapServer/MapServer/blob/dfdda8a18c69f22806c7d6e46bb2bf59f67ed941/mapogr.cpp#L2818>
 (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 (by me) suspected bug in MapServer. In particul in the 
code that determines if there are any features left in the result set. Or maybe 
I am missing something obvious and there is a mistake in the mapfile causing 
the issue. Did anyone see this behaviour before? 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 (https://github.com/arbakker/debug-ms-bbox-issue) 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.

Cheers,

Anton Bakker
Software Engineer

IT | Geo- en Vastgoedinformatie en Advies |PDOK
06-29 73 73 51 | [email protected]<mailto:[email protected]>

[cid:[email protected]]<http://www.kadaster.nl/>
[cid:[email protected]] [cid:[email protected]] 
<http://www.linkedin.com/company/kadaster> [cid:[email protected]] 
<http://www.twitter.com/het_kadaster> [cid:[email protected]] 
<http://www.facebook.com/HetKadaster/> [cid:[email protected]] 
<http://www.youtube.com/user/HetKadaster> [cid:[email protected]] 
<http://www.instagram.com/kadaster.nl/>



Disclaimer:
De inhoud van dit bericht is uitsluitend bestemd voor geadresseerde.
Gebruik van de inhoud van dit bericht door anderen zonder toestemming van het 
Kadaster
is onrechtmatig. Mocht dit bericht ten onrechte bij u terecht komen, dan 
verzoeken wij u
dit direct te melden aan de verzender en het bericht te vernietigen.
Aan de inhoud van dit bericht kunnen geen rechten worden ontleend.

Disclaimer:
The content of this message is meant to be received by the addressee only.
Use of the content of this message by anyone other than the addressee without 
the consent
of the Kadaster is unlawful. If you have received this message, but are not the 
addressee,
please contact the sender immediately and destroy the message.
No rights can be derived from the content of this message.
_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to