changeset 3740:6f1d5f310e08

Search delivers now bbox (geometry) for sections and bottlenecks.
author Sascha Wilde <wilde@intevation.de>
date Mon, 24 Jun 2019 12:43:30 +0200
parents e1bd5391a4b8
children 71de5ce5a402
files schema/search_functions.sql
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/schema/search_functions.sql	Mon Jun 24 11:58:08 2019 +0200
+++ b/schema/search_functions.sql	Mon Jun 24 12:43:30 2019 +0200
@@ -49,7 +49,7 @@
   SELECT COALESCE(json_agg(r),'[]')
     INTO _result
     FROM (SELECT objnam AS name,
-                 ST_AsGeoJSON(ST_Centroid(area))::json AS geom,
+                 ST_AsGeoJSON(ST_Envelope(area::geometry))::json AS geom,
                  'bottleneck' AS type
             FROM waterway.bottlenecks
             WHERE objnam ILIKE '%' || search_string || '%'
@@ -120,7 +120,7 @@
   SELECT COALESCE(json_agg(r),'[]')
     INTO _result
     FROM (SELECT objnam AS name,
-                 ST_AsGeoJSON(ST_Centroid(area))::json AS geom,
+                 ST_AsGeoJSON(ST_Envelope(area::geometry))::json AS geom,
                  'section' AS type
             FROM waterway.sections
             WHERE objnam ILIKE '%' || search_string || '%'