raido
v2.0.2
Published
Microservice for shortest path routing on Norwegian trails
Downloads
4
Readme
Microservice for shortest path routing on Norwegian trails using pgRouting and waymarked trails from the Norwegian Mapping Authority (Kartverket).
The name Raidō means "ride, journey" in the runic alphabets is the reconstructed Proto-Germanic name of the r- rune of the Elder Futhark ᚱ. The name is attested for the same rune in all three rune poems, Old Norwegian Ræið Icelandic Reið, Anglo-Saxon Rad.
ᚱ Ræið kveða rossom væsta; Reginn sló sværðet bæzta.
API
GET /v1/routing
- string
source
- start point coordinate on the formatx,y
- string
target
- end point coordinate on the formatx,y
- number
path_buffer
- route sensitivity / buffer (default2000
) - number
point_buffer
- point sensitivity / buffer (default10
) - string
bbox
- bbox bounding bounds on the formatx1,y1,x2,y2
- number
limit
- max number of shortest path to return (default1
)
Return shortest path from source
to target
. Returns a GeometryCollection
if a route is found.
Returned route
{
"type": "GeometryCollection",
"geometries": [{
"type": "LineString",
"coordinates": [...],
"properties": {
"cost": 1510.05825002283
}
}]
}
Mutliple routes
If you want multiple shortest path you can use the limit
query parameter to
control the number of routes returned. By default only the shortest route will
be returned.
{
"type": "GeometryCollection",
"geometries": [{
"type": "LineString",
"coordinates": [...],
"properties": {
"cost": 1510.05825002283
}
},{
"type": "LineString",
"coordinates": [...],
"properties": {
"cost": 1610.06825002284
}
}]
}
Route not found
If the source
or target
points can not be found or a route between them
could not be found the routing will return an empty GeometryCollection
.
{
"type": "GeometryCollection",
"geometries": []
}
Production
docker run --name postgres turistforeningen/pgrouting-n50:latest
docker run --link postgres turistforeningen/raido:latest -p 8080
Development
Requirements
- Docker 1.10+
- Docker Compose v1.4+
Start
docker-compose up
Test
docker-compose run --rm node npm run test
docker-compose run --rm node npm run lint