qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.37k stars 2.98k forks source link

QGIS Server filter does not work as expected for intersection filters #58220

Open timlinux opened 1 month ago

timlinux commented 1 month ago

What is the bug or the crash?

I am unable to get OGC Feature filters to work properly with spatial filters.

Steps to reproduce the issue

Scenario 1: Requesting features intersecting with a point should return zero features if the point does not intersect any feature:

http://37.27.93.162:8080/ogc/wfs3/collections/world/items?filter=intersects(geometry,%20POINT(10.0,20.0))

image

Scenario 2: Requesting features intersecting with a point should return zero features if the point does not intersect any feature AND the point is outside the layer bbox:

http://37.27.93.162:8080/ogc/wfs3/collections/world/items?filter=intersects(geometry, POINT(-1000.0,1000.0))

image

Scenario 3: Requesting features using a bbox filter where the bbox does not intersect, the layer bbox correctly returns 0 records:

http://37.27.93.162:8080/ogc/wfs3/collections/world/items?bbox=1000.0,2000.0,1001.0,2001.0

image

Scenario 4: Requesting features using a bbox filter where the bbox does intersect, the layer bbox incorrectly returns 5 records:

http://37.27.93.162:8080/ogc/wfs3/collections/world/items?bbox=0.0,0.0,0.001,0.001

image

Scenario 5: Requesting features using a point filter where the point overlays a polygon should return 1 feature but it returns all features:

http://37.27.93.162:8080/ogc/wfs3/collections/world/items?filter=intersects(geometry,%20POINT(2.13,21.80))

image

Scenario 6: Requesting features using a zero dimension bbox filter where the point overlays a polygon should return 1 feature but it returns 9 features:

http://37.27.93.162:8080/ogc/wfs3/collections/world/items?bbox=2.13,21.80,2.13,21.80

image

And a valid box returns the same: http://37.27.93.162:8080/ogc/wfs3/collections/world/items?bbox=2.13,21.80,2.14,21.81 @elpaso Do you have any idea about this? Am I misunderstanding the spec or QGIS Server capabilities?

Versions

Docker image for QGIS Server qgis/qgis-server:stable

qgis-server-1 | 12:52:02 INFO Server[18]: QGIS Server Starting : 3.38.1-Grenoble (3d4177afc6b)

Validation

I did validate that doing the same query in QGIS using a pg layer and select by location behaves as expected:

image

Supported QGIS version

New profile

Additional context

No response

elpaso commented 1 day ago

@timlinux where did you see filter is supported? It is not, and it is not in the API description.

elpaso commented 1 day ago

@timlinux I have tested all BBOX scenarios and I cannot reproduce any of the issues with current master.