logo separator

[mkgmap-dev] [PATCH v1] quick distance calculation

From Wolfgang v. Hansen wvhansen at fom.fgan.de on Wed May 20 06:18:46 BST 2009

On Tue, 19 May 2009, Mark Burton wrote:

> Well, that's a good question. As distance() mostly gets called to
> determine which of a bunch of points is nearest, it probably doesn't
> matter at all that the result is slightly "wrong".

Really? In that case you could as well change the metric from Euclidean to 
something more simple like the Manhattan metric:

   dist = abs(lat2-lat1) + costab[lat1] * abs(lon2-lon1)

where costab is a table lookup for cos(). This will still find a point 
that is close, but it is not guaranteed to be the same as with the 
Euclidean metric. Would that matter?


-Wolfgang



More information about the mkgmap-dev mailing list