Repository navigation
Conversation
473fa2e to
53d35ea
Compare
53d35ea to
ffaddad
Compare
|
Hello @tomkralidis, This functionality allows organisations to decouple applications from ArcGIS and gradually migrate towards open source solutions. Any chances this PR gets merged for next release? Best regards, |
|
Hi @fredmorin thinking out loud: would this be better addressed as a new pygeofilter backend instead? This way, the Esri provider wouid simply use pygeofilter esri backend and call/marshall accordingly (not to mention other projects beyond pygeoapi). |
Any thoughts? We could also consider as a future enhancement (and continue the review of this PR proper). |
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)