Skip to main content
5 of 5
replaced http://gis.stackexchange.com/ with https://gis.stackexchange.com/

Constructing a weighted graph a.k.a. a road network with distances for a specific area

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?