Pardon my ignorance in GIS/Routing tools as I'm new to it:

I have a map in OSM format and wanted to build a routable graph out of it ( to experiment a searching algorithm I have in my PhD thesis).

  1. I went to www.openstreetmap.org and selected an area and exported it. I got an map.os.xml file.
  2. I downloaded osm2po as I read somewhere here that it gives you a routing graph. Running java -jar osm2po-core-5.1.0-signed.jar prefix="osm2poConversionResults" map.osm.xml in the command line.

osm2po is poorly documented after this step; It just give me a nice map on http://localhost:8888/Osm2poService . I need a graph where every edge is annotated with its distance i.e. a weighted graph. Looking at the directory osm2poConversionResults I found file .gph which seems to be the one I am looking for, but opening it through TextEdit in Mac OS, get unreadable symbols.

So my question is: How to construct a weighted graph out of .osm.xml file in a very basic way with minimal reliance on complex software? Or at least a graph (I can look for the distances later). Another small question: Does the way of converting .osm to a graph differ substantially from software to software or is there a standard for the conversion?

1 Answer 1

  • Start with the demo.bat/sh and modify the params to use your source
  • You'll get two results, the gph and an sql.
  • The sql lets you proceed with PostGIS,pgRouting,QGIS
  • For deeper dives (native .gph) follow the Java-Example on the WebSite.
  • Or use osm2po's simple REST-API which handles most common cases. It is documented on the site as well.

The documentation is quite short and - sorry for that - spread over few locations. The best starter is the short help on the web site. The second is the osm2po.config where many options are explained. Feel free to ask things via mail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.