SDK for iOS Developer's Guide

Bicycle Routing

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.

Note:
  • 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 NMACoreRouter class and NMATransportModeBike as shown in the following example:

// Create an NMACoreRouter
NMACoreRouter* coreRouter = [[NMACoreRouter alloc] init];
NMAGeoCoordinates* geoCoord1 =
  [[NMAGeoCoordinates alloc] initWithLatitude:49.276271 longitude:-123.113224];
NMAGeoCoordinates* geoCoord2 =
  [[NMAGeoCoordinates alloc] initWithLatitude:49.1947289 longitude:-123.1762924];
NMAWaypoint* waypoint1 = [[NMAWaypoint alloc] initWithGeoCoordinates:geoCoord1];
NMAWaypoint* waypoint2 = [[NMAWaypoint alloc] initWithGeoCoordinates:geoCoord2];
NSMutableArray* stops = [[NSMutableArray alloc] initWithCapacity:4];
[stops addObject:waypoint1];
[stops addObject:waypoint2];

NMARoutingMode* routingMode = [[NMARoutingMode alloc]
  initWithRoutingType:NMARoutingTypeFastest
  transportMode:NMATransportModeBike
  routingOptions:0];

[coreRouter calculateRouteWithStops:stops routingMode:routingMode
  completionBlock:^(NMARouteResult *routeResult, NMARoutingError error) {

     // If the route was calculated successfully
    if (!error && routeResult && routeResult.routes.count > 0)
    {
    NMARoute* bikeRoute = [routeResult.routes objectAtIndex:0];
    // ...
    }
    else if (error)
    {
    // Display a message indicating route calculation failure
    }
  }];

Route Elevation

In an online bicycle routing session 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.

Note: Elevation-based speed estimations may change in the future.

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.

Figure 1. Plotted Chart of Elevations

To retrieve this elevation data, use geometryWithElevationData property on an NMARoute object and inspect altitude on each returned NMAGeoCoordinates object. If the altitude is not known at that location, the altitude property returns NMAGeoCoordinatesUnknownAltitudeValue.

Note: Route altitude data is available in online calculated routes for cars, pedestrians, trucks, and bicycles.