[OSM-dev] Getting a distance to a way

Jens Müller blog at tessarakt.de
Mon Jul 21 12:02:53 BST 2008


Sven Anders schrieb:
> Has someone a working algorithm to get the shortest distance from a node to a 
> way?
> 
> I try to explain it a 
> 
> Given a way between to nodes
> lat1,lon1 -------------> lat2,lon2
> 
> and a node latN,lonN.
> 
> Wanted:
> 
>  the length of the linear distance between the way and the node (latN,lonN).
> 

To a (one) specific way, or to any way? The former is basic high-school 
level linear algebra, the latter might be a bit more complicated (ok, 
http://svn.openstreetmap.org/applications/rendering/pyrender/whatAmIOn.py 
seems to do it by brute force).





More information about the dev mailing list