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

2009-07-15 Thread Simon Wood
On Tue, 14 Jul 2009 23:51:22 +0200
Frederik Ramm frede...@remote.org wrote:

 I happen to have a Perl script that does something like this

With some pretty simple mods (which even I could handle) your code can output a 
CSV list of lat/long/distance; however I struggled produce a decent contour 
from this.

Previously I had used a perl script to call Gnuplot to 'contour' the SRTM data, 
which worked fine. Using the data from your script had the problem that is was 
'sparse' point data rather than an XY full table of data and as such Gnuplot 
didn't do a good job at creating contours.

There are 2 ways around this I can think of:
1) split the ways in the source data into many more nodes, so that there is 
more chance of Gnuplot seeing a line trend.

2) Play some math tricks to interpolate the output data, effectively performing 
the same thing.

Simon.

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-15 Thread Gary68
simon,

i might have a christmas present for you...

please have a look at the files below:

http://www.gary68.de/temp/hofheim.png
http://www.gary68.de/temp/hofheim.svg
http://www.gary68.de/temp/hofheim.osm
http://www.gary68.de/temp/hofheim.gpx

you could insert the *.osm in your original osm file and have a render
rule for those entries. then you can use a renderer of your choice, like
KOSMOS. Don't know if gpx is useful though.

and here's the code (you will need the modules too!) - first BETA. no QA
took place :-)

http://svn.openstreetmap.org/applications/utils/gary68/distancemap.pl 
http://svn.openstreetmap.org/applications/utils/gary68/

any more wishes?

ps: i don't know if shapes like elevation lines really make sense
here...

pps: wiki page will follow!

cheers 

gary68
gerhard




On Tue, 2009-07-14 at 13:20 -0400, si...@mungewell.org wrote:
 Has anyone done any work in the area of making maps representing 'distance
 to feature' as measure along routable roadways/footways?
 
 Local school board is trying to drop school bus service school kids (from
 grade 1 up) within 2.0km of school and get them to walk to school (bear in
 mind this is a rural community with -40'C winters, wildlife such as
 bears/cougars and an ungated CPR train route through it).
 
 I have some ideas about representing the data, but does anyone have any
 suggestions on how to parse through each node and measure the distance
 along each way to produce a list with 'distance to school' tag for every
 hightway node? Is this the 'best' approach?
 
 The node list would/could then be passed through a variant of
 'strm2osm.pl' to produce a contour layer, and then merged/plotted with
 osmarender.
 
 
 I could also imagine that this 'work' might be usefull in 'distance to
 nearest  [bus stop, post box, etc]' maps/datasets.
 
 Cheers,
 Simon.
 
 
 ___
 talk mailing list
 talk@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/talk


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-15 Thread simon
 simon,

 i might have a christmas present for you...


Is it Christmas already?? I like presents ;-)

Looks like we've both been busy (just don't tell my boss I was up till
02:30 playing with this).

Using a combination of Fredrick's perl script and GnuPlot (to perform
contouring) I produced the attached contours. You should be able to open
in JOSM and then download the OSM lay to match.

I'll merge '.osm's and throw this through osmarender tonight to see what
they really look like. I'm a visual sort of guy, but you might be right
them being confussing to the average bod.


 http://svn.openstreetmap.org/applications/utils/gary68/distancemap.pl

One thing I was thinking was that the osm used for producing the distance
nodes, does not have to be the same as the mapping layer. This would
enable it to be customised (unroutable ways deleted for example) prior to
plotting.

There are also 'areas' for improvement, for example the main highway
running through Coleman is missing some sections of side walks and really
kids should only be crossing at signed crosswalks. This could be achieve
by duplicating the way slightly displaced and editing to force the above.

You might also want to factor in the 'access=private' tag and avoid stairs
(in the case of a walking map) as mum dropping kids at school often have
prams/strollers for siblings.

Cheers,
Simon.

PS. I started a wiki page to write up our efforts:
http://wiki.openstreetmap.org/wiki/Distance_maps


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-15 Thread Simon Wood
On Wed, 15 Jul 2009 09:00:23 +0200
Frederik Ramm frede...@remote.org wrote:

Finally managed to get something 'believable', see attached contours. You can 
download the corresponding roads with JOSM.

Problems where:
1) GnuPlot output number format didn't have enough digits and was distorting 
data.
2) Gnuplot dgrid3d needed to be tweaked to improve rejection of points further 
away.
3) Source data didn't contain enough nodes, had to interpolate

So I need to merge and render this out with Osmarender, which shouldn't be too 
difficult. And then write it up in some form for others to try.

I'd also like to look at selecting which ways to route down. At present it 
looks like it is fixed in the perl script but there are some it shouldn't use 
('access=private') and it would be nice to do two maps, one with stairs and one 
without (mother pushing pram...).

Cheers,
Simon.

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-15 Thread simon
 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.




___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-15 Thread Gora Mohanty
On Wed, 15 Jul 2009 13:30:44 -0400 (EDT)
si...@mungewell.org wrote:

  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.

Actually, an implementation of the Dijkstra algorithm is not
difficult at all. When we were trying to do this with Python
and Django, we came across a couple of sample implementations.
Better yet, there is the Boost graph library which already
implements the Dijkstra shortest path algorithm. The library
is in C++, but there are various bindings to it.

To push our own work, one can take a look at an implementation 
at http://citybyroad.com/ (Log in with user/password testuser/
gpstrack). This actually was a more ambitious attempt to get
shortest paths based on actual travel time from GPS traces.
However, ignore that for the moment, and also ignore the half-
completed state of the application. Leave all the drop-down
boxes as Unspecified, enter a from/to address via the auto-
complete boxes (try Raja Puri and Srijan Technologies,
allowing the auto-complete to take over after typing a few
letters), and click on the blue FIND ROUTE button. The result
shown on the map is from the Dijkstra shortest-path algorithm,
based on distance. The distance is calculated by integrating along
known routes, which is a fairly tedious, manual process, but OSM
routes should already have that information. For someone familiar
with Delhi, the application will be unable to find some routes, as
the database is not completely populated.

 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.
[...]
 Does this sound correct?

Your description covers the gist of the issue. The Dijkstra
algorithm actually visits every node in the network, and thus
running it once between two points should find all shortest
paths. In practice, it seems that the Boost implementation prunes
unlikely paths, so that one has to start with two extreme points,
and maybe rerun the algorithm a couple more times with other
extreme points in order to get full coverage.

Came into this conversation a little late, but if you had a
definite purpose in mind, we would be glad to share the code,
and maybe even put in some work on a reimplementation. What
language are you planning on using?

Regards,
Gora

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-15 Thread Gary68
of course this is possible. store the new min dist for each node if it
is lower than the old min dist. store next postbox node id if wanted.
all a matter of time and memory :-)


On Wed, 2009-07-15 at 13:30 -0400, si...@mungewell.org wrote:
  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.
 
 
 
 
 ___
 talk mailing list
 talk@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/talk


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread simon
Has anyone done any work in the area of making maps representing 'distance
to feature' as measure along routable roadways/footways?

Local school board is trying to drop school bus service school kids (from
grade 1 up) within 2.0km of school and get them to walk to school (bear in
mind this is a rural community with -40'C winters, wildlife such as
bears/cougars and an ungated CPR train route through it).

I have some ideas about representing the data, but does anyone have any
suggestions on how to parse through each node and measure the distance
along each way to produce a list with 'distance to school' tag for every
hightway node? Is this the 'best' approach?

The node list would/could then be passed through a variant of
'strm2osm.pl' to produce a contour layer, and then merged/plotted with
osmarender.


I could also imagine that this 'work' might be usefull in 'distance to
nearest  [bus stop, post box, etc]' maps/datasets.

Cheers,
Simon.


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread simon
 (bear in
 mind this is a rural community with -40'C winters, wildlife such as
 bears/cougars and an ungated CPR train route through it).

Of course everyone like as a map link:
http://www.openstreetmap.org/?mlat=49.6363mlon=-114.5065zoom=14layers=00B0FTF




___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread Tyler
This is generally the sort of thing done with a full blown GIS. Which is how
I would approach it. Use OSM as a data file, stripping out all of the
un-needed information, create a buffer around the schools of interest, maybe
map registered sex offenders within the buffer (if you have the equivalent
where you are) and all known hazards (I'd probably call unlit, unplowed or
forest path hazardous), and then create maybe a heatmap of danger. All of
this should be doable in something like QGIS.

Good luck!

-Tyler
___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread David Earl
If you're prepared to take the route it gives you, cyclestreets.net 
gives you distances along the route (as opposed to how the crow flies), 
as would any good routing system I'd expect.

David

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread Ævar Arnfjörð Bjarmason
On Tue, Jul 14, 2009 at 5:42 PM, Tylertyler.ritc...@gmail.com wrote:
 This is generally the sort of thing done with a full blown GIS. Which is how
 I would approach it. Use OSM as a data file, stripping out all of the
 un-needed information, create a buffer around the schools of interest, maybe
 map registered sex offenders within the buffer (if you have the equivalent
 where you are) and all known hazards (I'd probably call unlit, unplowed or
 forest path hazardous), and then create maybe a heatmap of danger. All of
 this should be doable in something like QGIS.

I now have this image of a thematic map in my head which features a
frightened child walking through a freezing forest having to dodge
cougars, wolves and pedobears.

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread John Smith

--- On Tue, 14/7/09, Ævar Arnfjörð Bjarmason ava...@gmail.com wrote:

 I now have this image of a thematic map in my head which
 features a
 frightened child walking through a freezing forest having
 to dodge
 cougars, wolves and pedobears.

Sounds like a blockbuster when compared to the usual garbage in garbage out of 
hollywood :)


  

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread Gary68
hi simon,

i will seriously think about it. there's my program osmrender.pl which
only needs an dijkstra algorithm and some more lines of code. then it
would do. please look at the wiki for the map it produces.

http://wiki.openstreetmap.org/wiki/Osmrender.pl

of course this can be finetuned.

ps: only thing i need is time...

gerhard


On Tue, 2009-07-14 at 13:20 -0400, si...@mungewell.org wrote:
 Has anyone done any work in the area of making maps representing 'distance
 to feature' as measure along routable roadways/footways?
 
 Local school board is trying to drop school bus service school kids (from
 grade 1 up) within 2.0km of school and get them to walk to school (bear in
 mind this is a rural community with -40'C winters, wildlife such as
 bears/cougars and an ungated CPR train route through it).
 
 I have some ideas about representing the data, but does anyone have any
 suggestions on how to parse through each node and measure the distance
 along each way to produce a list with 'distance to school' tag for every
 hightway node? Is this the 'best' approach?
 
 The node list would/could then be passed through a variant of
 'strm2osm.pl' to produce a contour layer, and then merged/plotted with
 osmarender.
 
 
 I could also imagine that this 'work' might be usefull in 'distance to
 nearest  [bus stop, post box, etc]' maps/datasets.
 
 Cheers,
 Simon.
 
 
 ___
 talk mailing list
 talk@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/talk


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread Gary68
another thought: it would also be possible to create additional nodes
(where i.e. type=dist, dist=xyz) in xml format that could be fed into an
existing osm file. the resulting file could be rendered by KOSMOS. all
this would need is an additional rule for the new distance nodes.

then you would have nicer maps :-))

gerhard

On Tue, 2009-07-14 at 13:20 -0400, si...@mungewell.org wrote:
 Has anyone done any work in the area of making maps representing 'distance
 to feature' as measure along routable roadways/footways?
 
 Local school board is trying to drop school bus service school kids (from
 grade 1 up) within 2.0km of school and get them to walk to school (bear in
 mind this is a rural community with -40'C winters, wildlife such as
 bears/cougars and an ungated CPR train route through it).
 
 I have some ideas about representing the data, but does anyone have any
 suggestions on how to parse through each node and measure the distance
 along each way to produce a list with 'distance to school' tag for every
 hightway node? Is this the 'best' approach?
 
 The node list would/could then be passed through a variant of
 'strm2osm.pl' to produce a contour layer, and then merged/plotted with
 osmarender.
 
 
 I could also imagine that this 'work' might be usefull in 'distance to
 nearest  [bus stop, post box, etc]' maps/datasets.
 
 Cheers,
 Simon.
 
 
 ___
 talk mailing list
 talk@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/talk


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread simon
 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.

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.

This would also be good for producing paper maps with distance values
along the side of motoring maps. You just add the distances along chosen
route.

Not sure how this would work for multiple reference points, ie. nearest
bus_stop. But that's not what I asked

Thanks,
Simon.



___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


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

2009-07-14 Thread Stephen Hope
Good luck changing their minds.  We have a similar rule near here - no
bad winters or wild animals, but some kids were supposed to walk
across a major multi-lane highway that had no crossing at all for
vehicles for several km each way, but they were within a 1km circle of
the school, so no transport.

2009/7/15  si...@mungewell.org:
 Local school board is trying to drop school bus service school kids (from
 grade 1 up) within 2.0km of school and get them to walk to school (bear in
 mind this is a rural community with -40'C winters, wildlife such as
 bears/cougars and an ungated CPR train route through it).


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk