[OSM-dev] Fwd: Routing over OSM data

Brandon Martin-Anderson badhill at gmail.com
Mon Oct 22 22:12:01 BST 2007


---------- Forwarded message ----------
From: Brandon Martin-Anderson <badhill at gmail.com>
Date: Oct 22, 2007 5:11 PM
Subject: Re: [OSM-dev] Routing over OSM data
To: Sven Braun <sven.braun at gmx.de>

Hey Sven,

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.

"libosm.py" is a library for parsing and topologically splitting OSM files
into graph structures.
"osm_to_pgrouting.py" is a script which converts OSM files into SQL files
for insertion into pgRouting-enabled databases.

Cheers,
B

On 10/22/07, Sven Braun <sven.braun at gmx.de> wrote:
>
> Hi,
> that looks really good.
> As you has seen i try the same, but with less success :-(
>
> Here I create an similar Routing page.
> http://132.230.29.38/openlayer/index2.html
>
> My way was to create a postgis Database with pgrouting on top.
> First I pick the next Roads from the selected start and end point and
> then do the routing.
>
> This could work very fine but i have a problem with the data.
>
> I tried to convert the data in two ways with the same problem:
>     1. With osm2pgsql
>     2. With osm2shp and shp2pgsql
>
> The problem is the following:
> The roads are stored in the geometrie table as linestring or
> multilinestring - thats okay.
> Now I want to execute the assign_vertex_id function to create the source
> and target fields.
> But at this point i have the problem.
>
> Lets consider to have the following 2 roads.
>
> Road A:    LINESTRING (0 2, 10 2)
> Road B:    LINESTRING (5 2, 5 0)
>
>   *----------+----------*
>                     |
>                     |
>                    *
> Here the assign_vertex_id function doesn't connect both roads.
>
> So I need the segments of the roads like:
>
> Road A1:    LINESTRING (0 2, 5 2)
> Road A2:    LINESTRING (5 2, 10 2)
> Road B:    LINESTRING (5 2, 5 0)
>
> So I could get an perfect Graph with an very fast routing.
>
> Has someone an idea to create these segments in an easy way from the
> actual planet.osm ?
> Or is my intention wrong ?
>
> regards
> sven
>
>
>
>
> Christopher Schmidt schrieb:
> > http://crschmidt.net/osm/routing-demo.html
> > (FF Only. *WILL NOT WORK IN IE.*)
> >
> >    1. Click "Set Start Point"
> >    2. Click on the map
> >    3. Click "Set Stop Point"
> >    4. Click on the Map, and without letting go, drag around.
> >
> > (May take some time to get started the first time, since the machine
> > it's running on is somewhat... overused, given the current load average
> > of 3/4.)
> >
> > Uses http://graphserver.sourceforge.net/ with some hacks on top to load
> > the small OSM file at http://crschmidt.net/osm/cambridgeport.osm .
> > Currently not entirely scalable, but that's a project for next weekend
> > -- this weekend was to just get it working :)
> >
> > Brandon has tested Graphserver with OSM graphs of ~20MB and had good
> > success -- now I just have to make the rest of the code scale similarly
> > :)
> >
> > This is also, for the record, showing the use of OpenLayers reprojection
> > support (not in trunk yet) -- you'll notice that it's using the standard
>
> > OSM tiles, but the mouse possition, permalink, etc. are in lat/lon.
> > (This is the part that doesn't work in IE, for the record.) This support
> > should go into trunk in the next release.
> >
> > Regards,
> >
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20071022/bbdad838/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libosm.py
Type: text/x-python
Size: 7021 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20071022/bbdad838/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osm_to_pgrouting.py
Type: text/x-python
Size: 1578 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20071022/bbdad838/attachment-0001.py>


More information about the dev mailing list