/neo4j-osm-routing

Route calculations using Neo4j graph database over OSM data

Primary LanguageJavaOtherNOASSERTION

#Route calculations using Neo4j graph database over OSM data

The goal of the project is to prove that Neo4j can be successfully used as a route calculation engine for OSM data.

##Problem

Talking about route calculation we want to think in terms of roads (OSM Way ) and road junctions (OSM Node ) .

However OSM Nodes represents road shape points and does not always corresponds to real-world road junctions.

This leads to the situation when resulting road graph is overloaded with redundant nodes and relations.

##Implementation

####OSM Data Loading

OsmImporter class is responsible for loading of OSM nodes and only those ways that are marked as 'highway' with respect to ONEWAY/BIDERECTIONAL attribution.

###Graph Optimization OsmRoutingOptimizer does the following:

  • removes nodes and corresponding relations that doesn't model real-world road junctions or start\end point of a road
  • creates new relations between survived nodes
  • each new relation will receive :
    • WAY_DISTANCE attribute that will hold relation's distance in meters value
    • WAY_GEOMETRY attribute that will contain WKT representation of road geometry(merged\removed nodes will go there). E.g.
LINESTRING (103.9740925 13.3479685, 103.9741521 13.3459453, 103.9741086 13.3455537)

Google Earth

####Route Calculation And Test RouteCalculator can be used to calculate route between two nodes :

  List<LineString> route = new RouteCalculator().findRoute(getStartNode(db), getEndNode(db));

Calculated route could be visualized using KML and Google Earth application.

Route calculated somewhere in Siem Reap :) Google Earth