diff pkg/controllers/cross.go @ 648:cf62cb84fa23

Cross sections: Added a naive O(N^2) algorithm to join the neighbored line segments.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 13 Sep 2018 16:54:52 +0200
parents 794592cad75a
children 7aeacd7f150b
line wrap: on
line diff
--- a/pkg/controllers/cross.go	Thu Sep 13 14:11:33 2018 +0200
+++ b/pkg/controllers/cross.go	Thu Sep 13 16:54:52 2018 +0200
@@ -41,7 +41,7 @@
 	}
 	defer rows.Close()
 
-	var segments []models.GeoJSONLineCoordinatesZ
+	var segments models.GeoJSONMultiLineCoordinatesZ
 
 	for rows.Next() {
 		var segment models.GeoJSONLineCoordinatesZ
@@ -55,13 +55,13 @@
 		return
 	}
 
-	// TODO: Join the segments.
+	joined := segments.Join()
 
 	jr = JSONResult{
 		Result: &models.CrossSectionOutput{
 			Type:        "Feature",
 			Geometry:    "MultLineString",
-			Coordinates: segments,
+			Coordinates: joined,
 		},
 	}