Trail Edit / Waypoints from photos: prevent creating different waypoints for near-by locations (#457)

* trail edit / waypoints from photos: prevent creating different waypoints for near-by locations

* remove not necessary imports

* remove changes from gitignore

* patch gitignore

* waypoint merge radius as category property

* change datamodel for merge radius (use more generic settings field for future implementations)

* fix npm run check issues

* several improvements/fixes

* fix

* move geo cluster code to db

* fix compile issue

* fix docker issue

* merge with existing waypoints

---------

Co-authored-by: Christian Beutel <>
Co-authored-by: Flomp <Flomp@users.noreply.github.com>
This commit is contained in:
slothful-vassal
2026-04-29 11:15:06 +02:00
committed by GitHub
parent 85e5fb6df7
commit 6d1d1236ef
28 changed files with 929 additions and 28 deletions

14
db/util/geo.go Normal file
View File

@@ -0,0 +1,14 @@
package util
import "math"
func HaversineDistance(lat1 float64, lon1 float64, lat2 float64, lon2 float64) float64 {
const earthRadiusKm = 6371
dLat := (lat2 - lat1) * (math.Pi / 180)
dLon := (lon2 - lon1) * (math.Pi / 180)
a := math.Sin(dLat/2)*math.Sin(dLat/2) +
math.Cos(lat1*(math.Pi/180))*math.Cos(lat2*(math.Pi/180))*
math.Sin(dLon/2)*math.Sin(dLon/2)
c := 2 * math.Atan2(math.Sqrt(a), math.Sqrt(1-a))
return earthRadiusKm * c * 1000
}