Route sections

VERSION 0.3.34
PUBLIC PREVIEW

Route sections are parts of the planned route that have specific characteristics, such as ones on a ferry or motorway, or sections with traffic incidents in them. Using sections, you can show users where these things lie on a planned route.

Route sections can be requested using RoutingOptions. Read more about route planning in the Planning a route guide.

The RoutingOptions.sectionTypes parameter specifies which section types should be included in the result. The SectionTypes are provided to RoutingOptions as a list, so you can provide more than one. The list of supported sections types can be found further in this guide.

1val amsterdam = GeoCoordinate(52.377956, 4.897070)
2val rotterdam = GeoCoordinate(51.926517, 4.462456)
3val routingOptions = RoutingOptions.Builder(itinerary = Itinerary(amsterdam, rotterdam))
4 .sectionTypes(listOf(SectionType.LANES, SectionType.MOTORWAY, SectionType.TUNNEL))
5 .build()

If a specific SectionType was included in the request, the appropriate value is returned in the response. It can be found within the Sections class that is a parameter of the returned Route object. The Sections contains a list of parameters for each Section.

If the corresponding section type was not set, it will be an empty list.

1val sections = routingResult.routes.first().sections
2val laneSections = sections.laneSections
3val motorwaySections = sections.motorwaySections
4val tunnelSections = sections.tunnelSections

Each of the responded sections has three properties:

  • List of geometries representing the section.
  • Distance from the start of the route to the section.
  • Length of the section in meters.

However, some of the specific section types return additional information about the section. The possible section types are:

  • SectionType.CAR_TRAIN - Represents a route section that is a car train.
  • SectionType.COUNTRY - Represents a route section indicating which countries the route is in.
    • It provides the 3-character ISO 3166-1 alpha-3 country code in which the section is located.
  • SectionType.FERRY - Represents a route section that is a ferry.
  • SectionType.MOTORWAY - Represents a route section that is a motorway.
  • SectionType.PEDESTRIAN - Represents a route section that is only suited for pedestrians.
  • SectionType.TOLL_ROAD - Represents a route section that requires a toll payment.
  • SectionType.TOLL_VIGNETTE - Represents a route section that requires a toll vignette.
    • It provides the 3-character ISO 3166-1 alpha-3 country code in which the section is located.
  • SectionType.TRAFFIC - Represents a route section with traffic information. It also provides:
    • The category of the incident - SimpleCategory.
    • The average effective speed in that section (in km/h).
    • The delay caused by the incident (in seconds).
    • The magnitude of the delay caused by the incident.
    • Detailed information about the traffic event (TPEG2-TEC standard).
  • SectionType.TRAVEL_MODE - Represents a route section with travel mode. This section type is related to the TravelMode request parameter.
  • SectionType.TUNNEL - Represents a route section that is a tunnel.
  • SectionType.CARPOOL - Represents a route section that is only open to HOV (high-occupancy vehicles) at the time of traversal. Roads with at least one unrestricted lane are not part of this section.
  • SectionType.URBAN - Represents a route section that is located within an urban area.
  • SectionType.LANES - Represents a route section with lane section available. It additionally provides:
    • Information about the Lane and Direction the driver should follow.
    • Information about the lane separators.
  • SectionType.SPEED_LIMIT - Represents a route section with a speed limit.
    • Provides the speed limit in the section in kilometers per hour.
  • SectionType.ROAD_SHIELDS - Represents a route section with road shield information.
    • Provides a reference to the road shield with the shield content.

Route with traffic sections