<br><br>---------- Forwarded message ----------<br><span class="gmail_quote">From: <b class="gmail_sendername">Brandon Martin-Anderson</b> <<a href="mailto:badhill@gmail.com">badhill@gmail.com</a>><br>Date: Oct 22, 2007 5:11 PM
<br>Subject: Re: [OSM-dev] Routing over OSM data<br>To: Sven Braun <<a href="mailto:sven.braun@gmx.de">sven.braun@gmx.de</a>><br><br></span>Hey Sven,<br><br>I've attached two scripts I've used to create topology databases from OSM files. I haven't cleaned them up much from where I last left them, and contain references to local files and various other junk. But considering I may never have a chance to finish this, I'll just give you what I have.
<br><br>"libosm.py" is a library for parsing and topologically splitting OSM files into graph structures.<br>"osm_to_pgrouting.py" is a script which converts OSM files into SQL files for insertion into pgRouting-enabled databases.
<br><br>Cheers,<br><span class="sg">B</span><div><span class="e" id="q_115c98e82846b1f1_2"><br><br><div><span class="gmail_quote">On 10/22/07, <b class="gmail_sendername">Sven Braun</b> <<a href="mailto:sven.braun@gmx.de" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
sven.braun@gmx.de</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>that looks really good.<br>As you has seen i try the same, but with less success :-(<br><br>Here I create an similar Routing page.<br><a href="http://132.230.29.38/openlayer/index2.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://132.230.29.38/openlayer/index2.html
</a><br><br>My way was to create a postgis Database with pgrouting on top.<br>First I pick the next Roads from the selected start and end point and<br>then do the routing.<br><br>This could work very fine but i have a problem with the data.
<br><br>I tried to convert the data in two ways with the same problem:<br>    1. With osm2pgsql<br>    2. With osm2shp and shp2pgsql<br><br>The problem is the following:<br>The roads are stored in the geometrie table as linestring or
<br>multilinestring - thats okay.<br>Now I want to execute the assign_vertex_id function to create the source<br>and target fields.<br>But at this point i have the problem.<br><br>Lets consider to have the following 2 roads.
<br><br>Road A:    LINESTRING (0 2, 10 2)<br>Road B:    LINESTRING (5 2, 5 0)<br><br>  *----------+----------*<br>                    |<br>                    |<br>                   *<br>Here the assign_vertex_id function doesn't connect both roads.
<br><br>So I need the segments of the roads like:<br><br>Road A1:    LINESTRING (0 2, 5 2)<br>Road A2:    LINESTRING (5 2, 10 2)<br>Road B:    LINESTRING (5 2, 5 0)<br><br>So I could get an perfect Graph with an very fast routing.
<br><br>Has someone an idea to create these segments in an easy way from the<br>actual planet.osm ?<br>Or is my intention wrong ?<br><br>regards<br>sven<br><br><br><br><br>Christopher Schmidt schrieb:<br>> <a href="http://crschmidt.net/osm/routing-demo.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://crschmidt.net/osm/routing-demo.html</a><br>> (FF Only. *WILL NOT WORK IN IE.*)<br>><br>>    1. Click "Set Start Point"<br>>    2. Click on the map<br>>    3. Click "Set Stop Point"
<br>>    4. Click on the Map, and without letting go, drag around.<br>><br>> (May take some time to get started the first time, since the machine<br>> it's running on is somewhat... overused, given the current load average
<br>> of 3/4.)<br>><br>> Uses <a href="http://graphserver.sourceforge.net/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://graphserver.sourceforge.net/</a> with some hacks on top to load
<br>> the small OSM file at <a href="http://crschmidt.net/osm/cambridgeport.osm" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://crschmidt.net/osm/cambridgeport.osm</a> .<br>> Currently not entirely scalable, but that's a project for next weekend<br>> -- this weekend was to just get it working :)<br>><br>> Brandon has tested Graphserver with OSM graphs of ~20MB and had good
<br>> success -- now I just have to make the rest of the code scale similarly<br>> :)<br>><br>> This is also, for the record, showing the use of OpenLayers reprojection<br>> support (not in trunk yet) -- you'll notice that it's using the standard
<br>> OSM tiles, but the mouse possition, permalink, etc. are in lat/lon.<br>> (This is the part that doesn't work in IE, for the record.) This support<br>> should go into trunk in the next release.<br>><br>

> Regards,<br>><br><br>_______________________________________________<br>dev mailing list<br><a href="mailto:dev@openstreetmap.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">dev@openstreetmap.org
</a><br><a href="http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev</a><br></blockquote></div><br>
</span></div><br clear="all">