Get your own routing data

Get your own routing data

In that case from Osnabrück … (in lower saxony(Germany))

Getting your own OpenStreetMap?-Routing-data is not the easiest step in the world. You know that you need data with a real topology?

In generel Shapefiles should have one, but be very carefull with OSM-Shapefiles. For most thing they work very nice, you get them e.g. from here: http://download.geofabrik.de/osm/

But please don`t use these Shapefiles (and shp2pgsql) for a routing and have a look at that discussion: http://lists.postlbs.org/pipermail/pgrouting-users/2009-April/000096.html

Many thanks to Daniel KASTL who brought the needed information:

… shp2pgsql imports the geometry correctly, but the topology function will not work with how OSM represents their ways, because ways consist (can consist) of more than one edge often.

osm2pgrouting cares about this and splits a way into more edges if they cross each other. It then automatically does the assign_vertex topology script and adds a few more tables to keep information about road types and classes. In a further section some problems using OSM-Shapes will be mentioned.

To get your own data you need to work with .osm (XML) files.

Please download the .osm-data from lower saxony (niedersachsen.osm.bz2) , e.g. from here: http://download.geofabrik.de/osm/europe/germany/

And then install osmosis, a very nice tool to work with osm-data, The wiki-site for osmosis you find here: http://wiki.openstreetmap.org/wiki/Osmosis

You need to extract the data from Osnabrück out of Lower saxony, it works like that:

screenshot on a windows-system

the command is

osmosis --read-xml niedersachsen.osm --bb left=7.917 right=8.1694 \
                                top=52.3537 bottom=52.217 --write-xml osnabrueck.osm

Now, you have the “real”-OSM-XML-Data from Osnabrück, (you find it in the download in the “data”-directory) but without a topology.

For that you need the tool “osm2pgrouting”.