Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds support for Common Query Language (CQL2) filtering to the ESRI
Feature Service provider (
ESRIServiceProvider). CQL2 filter expressions arenow translated into native ESRI query parameters, enabling attribute, temporal
and spatial filtering against ArcGIS Feature/Map services through OGC API -
Features.
Attribute & temporal predicates are translated into the ESRI
whereclause:
AND,OR,NOT)=,<>,<,<=,>,>=)LIKE,IN,BETWEEN,IS NULLT_BEFORE,T_AFTER,T_EQUALS,T_DURINGDATE/TIMESTAMPliteral comparisonsA single spatial predicate (
S_INTERSECTS,S_WITHIN,S_CONTAINS,S_CROSSES,S_TOUCHES,S_OVERLAPS,BBOX) is translated into the ESRIgeometry,geometryTypeandspatialRelparameters, and may be combinedwith attribute/temporal filters via a top-level
AND.Attribute values and literals are escaped (single quotes doubled) to prevent
SQL injection, and attribute names are validated against the layer fields.
Unsupported constructs return an HTTP 400 (
ProviderInvalidQueryError):S_DISJOINT, more than one spatial predicate, a spatial predicate nested underOR/NOT, and combining thebboxquery parameter with a CQL2 spatialpredicate.
Changes:
pygeoapi/provider/esri.py— CQL2→ESRI translation (attribute, temporal,spatial), input validation and escaping.
tests/provider/test_esri_provider.py— 18 new offline unit tests coveringall supported predicates, escaping, validation and error cases.
docs/source/publishing/ogcapi-features.rst— documentation of CQL2 supportand limitations; updated provider capability matrix (CQL).
Related Issue / discussion
#2433
Additional information
access required):
pytest tests/provider/test_esri_provider.py -k "cql2".test_cql2_query_live) querysampleserver6.arcgisonline.comand require outbound HTTPS access.S_WITHINusing the nativeesriSpatialRelWithinrelationship, which does not return point features contained within a
polygon;
S_INTERSECTSis recommended for point layers (documented).Dependency policy (RFC2)
Updates to public demo
Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)