[OSM-talk] 'Distance to feature' maps?

Frederik Ramm frederik at remote.org
Tue Jul 14 22:51:22 BST 2009


Hi,

simon at mungewell.org wrote:
> I suppose the way to do it would be to break the OSM highways down in
> unique ways which link junctions, so that each could be given a length
> (following node to node) and then use the dijkstra to calculate distance
> to each 'end' node.

I happen to have a Perl script that does something like this, you give 
it a starting point and a .osm file and how far you're willing to travel 
and it creates a picture like the one that is hopefully attached (where 
grey = out of range, light red = half range, dark red = full range).

The script creates an in-memory structure of all nodes with their 
neighbours and then uses a Dijkstra-like algorithm to flood-fill them 
with the best distance found. With some tweaking one can also switch to 
sketching travel times instead of pure distances, dependent on the 
highway type.

Oh heck I'll just attach it here even though this is talk not dev. 
Public Domain, and no warranties ;-)

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: output.png
Type: image/png
Size: 9709 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20090714/61b85df3/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: distance.pl
Type: application/x-perl
Size: 9243 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20090714/61b85df3/attachment.bin>


More information about the talk mailing list