[OSM-dev] I have created software for processing OSM data into networked graph structure

Daniel Lissner dlissner at gmail.com
Sat May 22 00:15:43 BST 2010

Hello OSM developers,
I am a computer scientist researcher at the University of Memphis
Computer Science Dept. In a recent project, we needed a representation
of the road network which would provide us with information about
connectivity and distance between sections of road. We found that the
OSM data provided a suitable platform to build such a graph-like
I have written a java program to process the XML format OSM data and
achieve this. Currently, each sequential pair of nodes referenced in
the WAY elements of roads are considered as a section of road. their
lat/long coords are passed to a method to calculate their distance via
law of spherical cosines and haversine formula. After every Way in the
dataset is processed, another method populates adjacency and incidence
information. Each "road section" (essentially a graph edge) knows
which road sections it is adjacent to, the two node points that make
its end points, its distance, it's heading (in respect to North) and
its street name. Thus far we are not very concerned with other
metadata but it's certainly feasible n possible to include. Further,
each node (essentially a graph vertex) knows its reference number, its
lat/lng coords, and all of the road sections which are incident to it.
The purpose of this structure for us was to serve as a state model for
simulations for our research work. While I'm not at liberty to share
all of our research purposes at this time, I am however able to share
the code I wrote which processes the osm data and creates a graph
structure of the road network.
The first version simply instantiates and populates several java
objects, which we tried to design and code as clean and efficiently as
possible. We are now migrating the processor to instead store the data
in a MySQL database.
So, I am writing the mailing list to ask if the osm developer
community would find any use for this little utility which creates a
connected graph structure of Ways, either as a straightforward set of
java objects or as a MySQL database. OSM has benefited our research
and I would certainly like to give back.


More information about the dev mailing list