From 5df936d65e2762bf850c7ffa8a5d8ac990f306e9 Mon Sep 17 00:00:00 2001 From: Andrew Yan Date: Fri, 1 Nov 2019 09:06:23 -0500 Subject: [PATCH] http://docs.opengeospatial.org/DRAFTS/17-069r1.html#_parameter_bbox specify that bbox queries should use intersect rather than contains --- pygeoapi/provider/postgresql.py | 2 +- tests/test_postgresql_provider.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pygeoapi/provider/postgresql.py b/pygeoapi/provider/postgresql.py index db1b146..e1032f3 100644 --- a/pygeoapi/provider/postgresql.py +++ b/pygeoapi/provider/postgresql.py @@ -199,7 +199,7 @@ class PostgreSQLProvider(BaseProvider): with DatabaseConnection(self.conn_dic, self.table) as db: cursor = db.conn.cursor(cursor_factory=RealDictCursor) sql_query = SQL("DECLARE \"geo_cursor\" CURSOR FOR \ - SELECT {},ST_AsGeoJSON({}) FROM {} WHERE {} @ \ + SELECT {},ST_AsGeoJSON({}) FROM {} WHERE {} && \ ST_MakeEnvelope({}, {}, {}, {})").\ format(db.columns, Identifier(self.geom), diff --git a/tests/test_postgresql_provider.py b/tests/test_postgresql_provider.py index 83d43c1..a362d4f 100644 --- a/tests/test_postgresql_provider.py +++ b/tests/test_postgresql_provider.py @@ -71,7 +71,7 @@ def test_query_bbox(config): boxed_feature_collection = psp.query( bbox=[29.3373, -3.4099, 29.3761, -3.3924] ) - assert len(boxed_feature_collection['features']) == 3 + assert len(boxed_feature_collection['features']) == 5 def test_get(config):