Convert OSM-Data to use in AMPL/MathProg


Is there a conversion tool to extract data from .osm-files and to convert them into a text file? I just need data for a plain directed graph G(V,E,c). Thus I need a table with at least three columns: start node, end node and the length of the edge.


Well .osm files are text files using XML markup. You will need to write your own script to translate the XML format to your custom one. This can be done in any scripting language even XSLT (which I don’t recommend). There are scripts in the SVN repository that can give you a headstart or at least ideas on how to solve this.

Yes, I just started to write a script in PHP. It seems to work.


please post the script when you have a prototype… :wink: I’m sure many people will find themselves in your position at sometime in the future.