From f740686d2f2c0be11482afae1f245a0b5499f791 Mon Sep 17 00:00:00 2001 From: Ray Miller Date: Mon, 12 Apr 2021 09:15:20 +0100 Subject: [PATCH] Improved duplicate suppression --- cmd/gpx-anomalies/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/gpx-anomalies/main.go b/cmd/gpx-anomalies/main.go index 22c43ab..28856c4 100644 --- a/cmd/gpx-anomalies/main.go +++ b/cmd/gpx-anomalies/main.go @@ -73,10 +73,12 @@ func findDuplicates(points []RoutePoint, fuzz, minDist, maxDist float64) { } d := euclideanDistance(p.Coordinate, q.Coordinate) D := q.Distance - p.Distance - if d < fuzz && D > minDist && D < maxDist && (lastError == nil || p.Distance-lastError.Distance > 500) { + if d < fuzz && D > minDist && D < maxDist { + if lastError == nil || p.Distance-lastError.Distance > 500 { + fmt.Printf("Point (%0.f, %0.f) revisited at %0.2f km and %0.2f km\n", + p.Coordinate.Easting, p.Coordinate.Northing, p.Distance/1000.0, q.Distance/1000.0) + } lastError = &p - fmt.Printf("Point (%0.f, %0.f) revisited at %0.2f km and %0.2f km\n", - p.Coordinate.Easting, p.Coordinate.Northing, p.Distance/1000.0, q.Distance/1000.0) } } }