Java Routing Machine
Build and run
Using Maven 2/3 :
mvn clean install tomcat7:run
This will start a Tomcat container at http://localhost:8080/routing with some test data.
The test data cover the Rhône-Alpes region in France. Test data are in geographic coordinates (WGS84, epsg:4326) with time(cost) = distance (meters).
Example queries
Using HTTPie client :
Locate nearest network node around Lyon (4.834413,45.767304) :
http GET :8080/routing/api/v1/distance lon==4.834413 lat==45.767304
Returns a GeoJSON Point :
{
"geometry": {
"coordinates": [
4.834413,
45.767304
],
"type": "Point"
},
"properties": {
"id": 24951,
"request_lat": 45.767304,
"request_lon": 4.834413
},
"type": "Feature"
}
Distance from Lyon (4.834413,45.767304) to Valence (4.890021,44.930435) :
http GET :8080/routing/api/v1/distance source==4.834413,45.767304 target==4.890021,44.930435
Returns :
{
"distance": 100497.0,
"distance_unit": "meters",
"source": {
"coordinates": [
4.834413,
45.767304
],
"type": "Point"
},
"target": {
"coordinates": [
4.890021,
44.930435
],
"type": "Point"
},
"time": 100497.0,
"time_unit": "minutes"
}
Route from Lyon to Valence :
http GET :8080/routing/api/v1/route source==4.834413,45.767304 target==4.890021,44.930435
Returns GeoJSON LineString.
30 km isochrone around Valence :
http GET :8080/routing/api/v1/isochrone lon==4.890021 lat==44.930435 \
distance==30000 concave==true
Returns GeoJSON Polygon.
Using as a library
Add the following dependency to your project pom.xml :
<dependency>
<groupId>com.github.mapkiwiz</groupId>
<artifactId>jgrapht-routing-core</artifactId>
<version>0.4</version>
</dependency>
Feeding in your own data
TODO
Getting data from OpenStreetMap
TODO