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

simon at mungewell.org simon at mungewell.org
Wed Jul 15 18:30:44 BST 2009


>> only needs an dijkstra algorithm and some more lines of code.
>
> sounds so simple... ;-)
>
> I had a look at the wikipedia page
> (http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) and that would look
> to make sense.
>

As you may have noticed I've actually had a relatively amount of success
with this, but my brain is off on the 'multiple targets' question.

Is it valid to repeat the dijkstra algorithm with multiple 'target' nodes,
so you could find the shortest path to (say) any playground? Target nodes
could auto-magically be extracted from OSM file based on tags.

Is this as simple as keeping the 'found' state in a seperate variable for
each node (rather than using the distance variable as a found state)?

Then you could 'walk' from each target node looking at 'found' state and
'distance' to determine whether this node was closer to new target than
the previous, if it were you adjust the 'found' to indicate which target
was closer, set your distance and then continue to walk.

You'd also have a record (in the 'found' state) of which target was closer.

Does this sound correct?
Simon.







More information about the talk mailing list