From 94bb09b876ec633f3a3237f68538804a03ec92e5 Mon Sep 17 00:00:00 2001 From: MzHub Date: Fri, 12 Jan 2018 19:39:42 +0200 Subject: [PATCH] Output markers CSV in same format as input CSV --- osmcoverer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osmcoverer.go b/osmcoverer.go index 00b5935..204ede1 100644 --- a/osmcoverer.go +++ b/osmcoverer.go @@ -327,8 +327,10 @@ func outputContainedMarkersToCsv(markers []Marker, outputDirectory string) { writer := csv.NewWriter(csvFile) defer writer.Flush() for _, marker := range markers { - for _, within := range marker.feature.Properties["within"].([]string) { - err := writer.Write([]string{marker.feature.Properties["name"].(string), within}) + lat, lng := marker.feature.Geometry.Point[1], marker.feature.Geometry.Point[0] + within := marker.feature.Properties["within"].([]string) + if len(within) > 0 { + err := writer.Write([]string{marker.feature.Properties["name"].(string), strconv.FormatFloat(lat, 'f', -1, 64), strconv.FormatFloat(lng, 'f', -1, 64)}) check(err) } }