Re: [Geographiclib-users] Comparing distances between geographic coordinates
Geographic library
Brought to you by:
karney
From: Charles K. <cha...@sr...> - 2014-05-18 17:54:10
|
Most people are poor at knowing where the bottlenecks in their code will be. So my recommendation would be to use the geodesic distance and only worry about finding a substitute if that proves too slow. On 05/18/2014 12:33 PM, Edward Lam wrote: > Hi Charles, > > Yes, I want the metric to correlate to real distances. Some of the hardware I'm looking at can be very underpowered (think 400 MHz clock speeds) which may (or may not) matter. I figured I'd ask anyway if there some proxy distance measure I could use that was faster to compute. > > Thanks for your suggestion regardless. > > -Edward > >> On May 17, 2014, at 5:04 PM, Charles Karney <cha...@sr...> wrote: >> >> 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 >> |