Class OsmRouting
- All Implemented Interfaces:
HttpServer.Handler
Answers turn-by-turn routes in the shape of OSRM's HTTP API, so the
client's OsrmRouteService -- or any other OSRM client -- can point at
this backend instead of a separate routing server.
Mounted at a prefix, it answers
GET {prefix}/route/v1/{profile}/{lon},{lat};{lon},{lat}[;...] with the
profiles driving, walking and cycling (car, foot and bike are
accepted too). The query parameters understood are steps
(true/false), overview (full, simplified or false; simplified
is answered as full), geometries (polyline or polyline6) and
alternatives, which is accepted and always answered with one route.
A failure is an HTTP 400 whose JSON body carries OSRM's code:
InvalidUrl, InvalidQuery, InvalidOptions, TooBig, NoSegment
(a waypoint too far from any road) or NoRoute.
OsmExtract extract = OsmExtract.load("/data/region.osm.pbf");
Backend.builder()
.handler(new OsmRouting(extract, "/osrm"))
.handler(new OsmGeocoding(extract, "/geocode"))
.start();
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
OsmRouting
extract: the loaded extractprefix: the URL path the handler is mounted at, "" for the root
-
-
Method Details
-
handle
- Specified by:
handlein interfaceHttpServer.Handler- Throws:
Exception
-