Skip to main content

Road classification

A newer version of the Navigation SDK is available
This page uses v1.6.2 of the Mapbox Navigation SDK. A newer version of the SDK is available. Learn about the latest version, v2.20.2, in the Navigation SDK documentation.

The StepIntersection object contains road classification details. It is possible to get a road class and check if it is urban.

Road class

Each intersection object on the route has information about the classification of the road exiting the intersection along the route. To access that information, use the MapboxStreetsV8 object. Properties in this object correspond to properties in the Mapbox Streets v8 tileset. This class is only available on the DirectionsCriteria.PROFILE_DRIVING profile.


RouteProgressObserver routeProgressObserver = new RouteProgressObserver() {
@Override
public void onRouteProgressChanged(RouteProgress routeProgress) {
List<StepIntersection> intersections = routeProgress.getCurrentLegProgress().getCurrentStepProgress().getStep().intersections();
for (StepIntersection intersection : intersections) {
String roadClass = intersection.mapboxStreetsV8().roadClass();
}
}
};

Urban road

isUrban is a boolean indicating whether the road exiting the intersection is in an urban area. This value is determined by the density of the surrounding road network. This class is only available on the DirectionsCriteria.PROFILE_DRIVING profile.


RouteProgressObserver routeProgressObserver = new RouteProgressObserver() {
@Override
public void onRouteProgressChanged(RouteProgress routeProgress) {
List<StepIntersection> intersections = routeProgress.getCurrentLegProgress().getCurrentStepProgress().getStep().intersections();
for (StepIntersection intersection : intersections) {
Boolean isUrban = intersection.isUrban();
}
}
};