Database Reference
In-Depth Information
Loading data from OpenStreetMap and
finding the shortest path using A*
Testdataaregreatforunderstandinghowalgorithmswork,buttherealdataisoften
moreinteresting.Agoodsourceforrealdataworldwideis OpenStreetMap ( OSM ),a
worldwide,wiki-stylegeospatialdataset.WhatiswonderfulaboutusingOSMincon-
junctionwithpgRoutingisthatitisinherentlyatopologicalmodel,meaningthatitfol-
lows the same kinds of rules in its construction that we do in graph traversal within
pgRouting. Because of how editing and community participation works in OSM, it is
often an equally good or better data source than commercial ones and, of course,
quite compatible with our open source model.
AnothergreatfeatureisthatthereisafreeandopensourcesoftwaretoingestOSM
data and import it into a routing database— osm2pgrouting .
Getting ready
Itisrecommendedtoeithergetthedownloadablefilesfrom http://metro.teczno.com ,
or download the example dataset that we have provided, available at ht-
tp://www.packtpub.com/support . Either way, you will be using the XML OSM data.
You can also get custom extracts directly from the web interface at ht-
tp://www.openstreetmap.org/ , but this could significantly limit the area we would be
able to extract.
Once we have the data, we need to unzip it using our favorite compression utility.
Double-clickingonthefiletounzipitwilltypicallyworkonWindowsandMacOSma-
chines.TwoofthegoodutilitiesforunzippingonLinuxare bunzip2 and zip .What
willremainisanXMLextractofthedatawewantforrouting.Inourusecase,weare
downloading the data for the Greater Cleveland area.
Now, we need a utility for placing these data into a routable database. An example
of one such tool is osm2pgrouting , which is often a part of binary installs of
pgRouting, butitcanalsobedownloadedandcompiledusingtheinstructions at ht-
tp://pgrouting.org/docs/tools/osm2pgrouting.html .
Search WWH ::




Custom Search