diff pkg/imports/wp.go @ 2087:5d3d2e823314

Waterway profiles: Do a little buffeing around the point to be more tolerant when finding the right line string.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 01 Feb 2019 10:56:29 +0100
parents 6096ec4951f8
children 3f32b18bbd4c
line wrap: on
line diff
--- a/pkg/imports/wp.go	Thu Jan 31 18:42:57 2019 +0100
+++ b/pkg/imports/wp.go	Fri Feb 01 10:56:29 2019 +0100
@@ -92,10 +92,10 @@
 
 	insertWaterwayProfileSQL = `
 WITH point AS (
-  SELECT ST_Transform(geom::geometry, $14::int) geom
+  SELECT ST_Buffer(ST_Transform(geom::geometry, $14::int), 0.001) geom
   FROM waterway.distance_marks_virtual
   WHERE location_code =
-	($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int)
+    ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int)
 )
 INSERT INTO waterway.waterway_profiles (
   location,
@@ -113,7 +113,8 @@
   ( SELECT ST_Transform(geom, 4326)::geography
     FROM wp_geoms
     WHERE geom && ( SELECT geom from point ) AND
-	  ST_Intersects(geom, ( SELECT geom FROM point ))
+      ST_Intersects(geom, ( SELECT geom FROM point ))
+    LIMIT 1
   ),
   $6,
   $7,