changeset 676:bd215c4325ce

Cross sections: Only join point in x/y plane.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 19 Sep 2018 16:09:09 +0200
parents 3e2eeb215d0e
children 3605af94d1ee
files pkg/models/cross.go
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/models/cross.go	Tue Sep 18 18:23:15 2018 +0200
+++ b/pkg/models/cross.go	Wed Sep 19 16:09:09 2018 +0200
@@ -260,15 +260,16 @@
 	return math.Sqrt(dLat*dLat+x*x) * EarthRadius
 }
 
-func (cz GeoJSONCoordinateZ) quant() GeoJSONCoordinateZ {
-	const (
-		xyScale = 1e6
-		zScale  = 1e5
-	)
-	return GeoJSONCoordinateZ{
-		Lon: math.Round(cz.Lon*xyScale) / xyScale,
-		Lat: math.Round(cz.Lat*xyScale) / xyScale,
-		Z:   math.Round(cz.Z*zScale) / zScale,
+type point struct {
+	x float64
+	y float64
+}
+
+func (cz GeoJSONCoordinateZ) quant() point {
+	const xyScale = 1e6
+	return point{
+		math.Round(cz.Lon*xyScale) / xyScale,
+		math.Round(cz.Lat*xyScale) / xyScale,
 	}
 }
 
@@ -292,7 +293,7 @@
 		order  int
 	}
 
-	heads := make(map[GeoJSONCoordinateZ]*value)
+	heads := make(map[point]*value)
 
 	for i, coords := range ml {
 		key := coords[len(coords)-1].quant()