changeset 919:271561dce2e6

Store contour lines in 2D We have the height as an attribute value and use the lines only for display on a map. There's no need to store height with every vertex additionally.
author Tom Gottfried <tom@intevation.de>
date Thu, 04 Oct 2018 16:32:47 +0200
parents 5b90217aa1bb
children 862cc5ba4d1d
files cmd/octree2contour/store.go schema/gemma.sql
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/cmd/octree2contour/store.go	Thu Oct 04 12:45:25 2018 +0200
+++ b/cmd/octree2contour/store.go	Thu Oct 04 16:32:47 2018 +0200
@@ -26,15 +26,17 @@
   sr.id,
   $1,
   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
+    ST_CollectionExtract(
+      ST_Force2D(
+        ST_Intersection(
+          ST_Transform(sr.area::geometry, $3::integer),
+          ST_GeomFromWKB($2, $3::integer)
+        )
+      ),
+      2
+    ),
+    4326
+  )
 FROM waterway.sounding_results sr
 WHERE bottleneck_id = $4 AND date_info = $5
 `
--- a/schema/gemma.sql	Thu Oct 04 12:45:25 2018 +0200
+++ b/schema/gemma.sql	Thu Oct 04 16:32:47 2018 +0200
@@ -419,7 +419,7 @@
     CREATE TABLE sounding_results_contour_lines (
         sounding_result_id int NOT NULL REFERENCES sounding_results,
         height numeric NOT NULL,
-        lines geography(multilinestringz, 4326) NOT NULL,
+        lines geography(multilinestring, 4326) NOT NULL,
         UNIQUE (sounding_result_id, height)
     )
     -- A view to help geoserver serve contour lines.
@@ -428,7 +428,7 @@
         SELECT bottleneck_id,
                 date_info,
                 height,
-                CAST(lines AS geometry(multilinestringz, 4326)) AS lines
+                CAST(lines AS geometry(multilinestring, 4326)) AS lines
             FROM waterway.sounding_results_contour_lines cl
                 JOIN waterway.sounding_results sr
                     ON sr.id = cl.sounding_result_id