Skip to content
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

OAPIF: CQL layer filter expression is not used in request #60092

Open
2 tasks done
kannes opened this issue Jan 9, 2025 · 1 comment
Open
2 tasks done

OAPIF: CQL layer filter expression is not used in request #60092

kannes opened this issue Jan 9, 2025 · 1 comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers

Comments

@kannes
Copy link
Contributor

kannes commented Jan 9, 2025

What is the bug or the crash?

I am trying to figure out what options exist to spatially filter OAPIF layers and how to write the expressions.

Probably I am using things wrong, but it seems to me that a valid filter expression is not actually used in the request to the server.

I have tried with examples from the tests. In https://github.com/qgis/QGIS/blob/0984ab8d9bcef608a4a8b2c840fafebeb1b1ca68/tests/src/python/test_provider_oapif.py many filter strings are defined and set to the test layer with .setSubsetString() below.

For example

"""intersects_bbox($geometry, geomFromWkt('POLYGON((-180 -90,-180 90,180 90,180 -90,-180 -90))'))""",
"""filter=S_INTERSECTS(geometry,BBOX(-180,-90,180,90))&filter-lang=cql2-text""",

and

"""intersects($geometry, geomFromWkt('POINT(-70.5 66.5))'))""",
"""filter=S_INTERSECTS(geometry,POINT(-70.5%2066.5))&filter-lang=cql2-text""",

If I use those strings as layer filter "subset string" (via GUI or Python) they are nowhere to be found in the logged network requests.

I am testing with the endpoint https://ogc-api.geobasis-bb.de/datasets/vg/collections/bz in EPSG:4326

Steps to reproduce the issue

Case 1: intersects_bbox and POLYGON

intersects_bbox($geometry, geomFromWkt('POLYGON((-180 -90,-180 90,180 90,180 -90,-180 -90))')) results in e.g.
https://ogc-api.geobasis-bb.de/datasets/vg/collections/bz/items?limit=100&bbox=50.57793710916428154,4.66530253396964145,54.41790023316391967,16.90450532457161259&bbox-crs=http://www.opengis.net/def/crs/EPSG/0/4326&crs=http://www.opengis.net/def/crs/EPSG/0/4326 and no relevant headers.

According to the tests there is some magical BBOX conversion and S_INTERSECTS(geometry,BBOX(-180,-90,180,90))&filter-lang=cql2-text should appear in the URL.

Case 2: intersects and POINT

intersects($geometry, geomFromWkt('POINT(-70.5 66.5))')) results in e.g. https://ogc-api.geobasis-bb.de/datasets/vg/collections/bz/items?limit=100&bbox=48.16256830302904035,3.03290265805188319,51.09329552211858783,9.15250405335286921&bbox-crs=http://www.opengis.net/def/crs/EPSG/0/4326&crs=http://www.opengis.net/def/crs/EPSG/0/4326 and no relevant headers.

According to the tests, filter=S_INTERSECTS(geometry,POINT(-70.5%2066.5))&filter-lang=cql2-text should have been appended to the URL.

While the BBOX magic in the query above might have lead to some "correct but hard to understand" result before, in this case there is a simple POINT and this should definitely be passed, right?

Versions

QGIS version 3.40.2-Bratislava
QGIS code branch Release 3.40
 
Libraries
Qt version 5.15.15
Python version 3.12.8
GDAL/OGR version 3.10.0
PROJ version 9.5.1
EPSG Registry database version v11.022 (2024-11-05)
GEOS version 3.13.0-CAPI-1.19.0
SQLite version 3.47.2
PDAL version 2.8.2 (Compiled)2.8.3 (Running)
PostgreSQL client version unknown
SpatiaLite version 5.1.0
QWT version 6.3.0
QScintilla2 version 2.14.1
OS version Manjaro Linux
 
Active Python plugins
MemoryLayerSaver 5.0.2
spatial_filter 1.7
plugin_reloader 0.17
db_manager 0.1.20
MetaSearch 0.3.6
grassprovider 2.12.99
processing 2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

image

@kannes kannes added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 9, 2025
@agiudiceandrea agiudiceandrea added the Data Provider Related to specific vector, raster or mesh data providers label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers
Projects
None yet
Development

No branches or pull requests

2 participants