diff schema/search_functions.sql @ 3738:9f20d2b59d4c

Added ISRS code search for rhm.
author Sascha Wilde <wilde@intevation.de>
date Mon, 24 Jun 2019 11:56:38 +0200
parents e3f15a163823
children e1bd5391a4b8
line wrap: on
line diff
--- a/schema/search_functions.sql	Mon Jun 24 11:52:07 2019 +0200
+++ b/schema/search_functions.sql	Mon Jun 24 11:56:38 2019 +0200
@@ -25,6 +25,14 @@
                ST_AsGeoJSON(geom)::json AS geom, 'rhm' AS type
         FROM waterway.distance_marks_virtual
         WHERE (location_code).hectometre = search_string::int) r;
+  ELSIF is_ISRSstring(search_string) THEN
+    SELECT COALESCE(json_agg(r),'[]')
+      INTO _result
+      FROM (SELECT (location_code).hectometre || ' rhm' AS name,
+  			replace(concat(location_code), ',','') AS locationcode,
+               ST_AsGeoJSON(geom)::json AS geom, 'rhm' AS type
+        FROM waterway.distance_marks_virtual
+        WHERE location_code = isrs_fromText(search_string)) r;
   ELSE
     _result='[]';
   END IF;