changeset 742:fb9faf2c4f60

Clip contour lines against bounding area of sounding result.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 24 Sep 2018 13:14:49 +0200
parents 8bb2e48e2dfd
children fdff2de616ad
files cmd/octree2contour/store.go
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cmd/octree2contour/store.go	Mon Sep 24 12:42:24 2018 +0200
+++ b/cmd/octree2contour/store.go	Mon Sep 24 13:14:49 2018 +0200
@@ -23,10 +23,19 @@
 INSERT INTO waterway.sounding_results_contour_lines
   (sounding_result_id, height, lines)
 SELECT
-  id,
+  sr.id,
   $1,
-  ST_Transform(ST_SetSRID(ST_GeomFromWKB($2), $3), 4326)::geography
-FROM waterway.sounding_results
+  ST_Transform(
+    ST_Translate(
+      ST_Force3D(
+        ST_CollectionExtract(
+          ST_Force2D(
+            ST_Intersection(
+              ST_Transform(sr.area::geometry, $3::integer),
+              ST_SetSRID(
+                ST_GeomFromWKB($2), $3::integer))), 2)), 0.0, 0.0, $1::numeric),
+  4326)::geography
+FROM waterway.sounding_results sr
 WHERE bottleneck_id = $4 AND date_info = $5
 `
 )