Re: [Geographiclib-users] Comparing distances between geographic coordinates
Geographic library
Brought to you by:
karney
From: Charles K. <cha...@sr...> - 2014-05-17 21:04:49
|
Lots of distance metric will satisfy the triangle inequality * geodesic distance on ellipsoid * Euclidean distance on ellipsoid * surface distance on sphere * Euclidean distance on sphere * a Manhattan distance |dlat| + |dlon| etc. However, I suspect you want a stronger condition, namely d(A,B) < d(A,C) implies that B really is closer to A than C. For this I recommend just using the true geodesic distance (e.g., from GeographicLib). You can do a million such distance calculations in a couple of seconds. On 05/17/2014 03:45 PM, Edward Lam wrote: > Hi, > > I trying to write an app that performs route planning through a graph of > points given by their GPS latitude/longitude coordinates. So to do this, > I need to compare the relative distances between these points such that > the triangle inequality holds. What is the best/fastest way to do so? > > There's a great deal of description on the web on how to compute > distances between two GPS coordinates ranging from approximate ones > based on the haversine formula via an idealized sphere to more accurate > ellipsoidal ones like the one in GeographicLib. > > For this application, I don't need real distances between the points, > just some metric so that the triangle inequality holds. I'm tempted to > use the haversine formula since it is cheaper than the alternatives but > it has distortions depending on the chosen radius that may affect the > triangle inequality? Or am I over thinking this? Is there some > projection I can use that is both cheap and accurate? > > Thanks, > -Edward > |