The bicycle routing feature provides route calculation using car and pedestrian roads with bicycle-specific speed estimations. This type of routing can be performed online or offline, with elevation data being available in an online request.
- Bicycle routing is currently offered as a beta feature. APIs may change without notice.
- Bike-specific roadways are not yet supported.
Bicycle routing includes pedestrian-only roads and road segments that require traversing a one-way road opposite the allowed direction of travel. When a road is not open for driving in the travel direction, the routing algorithm assumes that the user must walk the bicycle, and therefore it uses the pedestrian walking speed for such segments. As a special exception to this rule, pedestrian segments located in parks are assumed to be open for bicycles, so full bicycle speed is used there. Generally, such walk-only segments are used in bicycle routing only when they provide a big shortcut, or when a waypoint is located on such a segment.
Performing a Bicycle Routing Request
You can perform bicycle routing by using the
CoreRouter class and
RouteOptions.TransportMode.BICYCLE, as shown in the following example:
CoreRouter router = new CoreRouter(); // Create the RoutePlan and add two waypoints RoutePlan routePlan = new RoutePlan(); routePlan.addWaypoint(new RouteWaypoint(new GeoCoordinate(49.276271, -123.113224))); routePlan.addWaypoint(new RouteWaypoint(new GeoCoordinate(49.1947289, -123.1762924))); RouteOptions routeOptions = new RouteOptions(); routeOptions.setTransportMode(RouteOptions.TransportMode.BICYCLE); routeOptions.setRouteType(RouteOptions.Type.FASTEST); routePlan.setRouteOptions(routeOptions); // Calculate the route, assuming that you have already implemented RouteListener. // See the Car Routing section for more details. router.calculateRoute(routePlan, new RouteListener());
In an online bicycle routing session, the HERE SDK considers elevation changes when determining what speed should be used on the given road. When going uphill, speed decreases, possibly down to the pedestrian speed. When going downhill, speed increases.
You can also create an elevation profile of a route, similar to the following screenshot, by using altitude data of the points on a calculated route.
To retrieve this elevation data, call the
Route.getRouteGeometryWithElevationData() method and inspect the altitude on each returned
GeoCoordinate object. If the altitude is not known at that location, calling
GeoCoordinate.getAltitude() returns the