diff pkg/imports/sr.go @ 971:f9fb6c399f3f

Moved generating of tins to octree package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 18 Oct 2018 11:52:13 +0200
parents 1e2dce348cfb
children 17a03a84b0e8
line wrap: on
line diff
--- a/pkg/imports/sr.go	Thu Oct 18 10:14:46 2018 +0200
+++ b/pkg/imports/sr.go	Thu Oct 18 11:52:13 2018 +0200
@@ -75,7 +75,13 @@
     ST_Transform(ST_GeomFromWKB($5, $6::integer), 4326)::geography
   END)
 )
-RETURNING id`
+RETURNING
+  id,
+  CASE WHEN ST_Y(ST_Centroid(point_cloud::geometry)) > 0 THEN
+    32600
+  ELSE
+    32700
+  END + floor((ST_X(ST_Centroid(point_cloud::geometry))+180)/6)::int + 1`
 )
 
 func (srd *SoundingResultDate) UnmarshalJSON(data []byte) error {
@@ -308,19 +314,21 @@
 	defer tx.Rollback()
 
 	var id int64
+	var epsg uint32
 
-	err = tx.QueryRow(insertPointsSQL,
+	if err := tx.QueryRow(insertPointsSQL,
 		m.Bottleneck,
 		m.Date.Time,
 		m.DepthReference,
 		xyz.AsWKB(),
 		polygon.AsWBK(),
-		m.EPSG).Scan(&id)
-
-	if err != nil {
+		m.EPSG,
+	).Scan(&id, &epsg); err != nil {
 		return err
 	}
 
+	log.Printf("EPSG: %d\n", epsg)
+
 	// TODO: Build octree
 	// TODO: Generate iso-lines