Scooter Routing with HERE Routing API
Whether you are cruising along the stunning coastal road in Hawaii or delivering food in South East Asia, riding in a scooter (a low-power two-wheeler vehicle, mainly used for in-city travel and transportation) takes different routes than driving in a normal passenger car. The HERE Routing API provides a comprehensive set of tools and services for developers to build sophisticated routing applications. it supports different transport modes that allow the creation of routes that consider rules and restrictions related to specific transport types: cars, trucks, scooters, and so on.
In this blog post, we will discuss the transport mode scooter from HERE Routing API.
Transport Mode: Scooter
With a specific transport mode enabled, the various Routing services use road network segments allowed for use by vehicles of the selected type while taking into account the restrictions that might be applicable. The scooter routing mode uses a road network defined by the segments with MOTORCYCLE_OPEN flag. It gives a route that avoids all those roads which are not allowed for scooters.
The implementation uses the term "scooter" to refer to a low-power two-wheeler vehicle, mainly used for in-city travel and transportation. This behavior is reflected by avoiding highways and applying a speed cap of 60km/hr. However, you can override these options with these parameters: scooter[allowHighway] and vehicle[speedCap] respectively.
To use scooter routing, set transportMode=scooter
. Only the fast routing mode is supported.
The use of highway on scooter route
- Include highway on scooter route.
https://router.hereapi.com/v8/routes?
destination=53.335542,14.522257&
origin=53.338226499,14.5058642048&
transportMode=scooter&
scooter[allowHighway]=true&
apikey={YOUR_API_KEY}
- Exclude highway on scooter routeThere is a parameter
avoid[features]=controlledAccessHighway
, which prevents highway usage. If this parameter is used, then scooters are not allowed to use highways even ifallowHighway
is set to true. In this case, withscooter[allowHighway]=true
andavoid[features]=controlledAccessHighway
, the scooter is not allowed on the highway and the calculation returns the fastest route that does not go through a highway. If no route is possible that avoids the highway, then the calculation returns a route that makes minimal use of the highway along with a notice (with notice codeviolatedAvoidControlledAccessHighway
). Refer to this tutorial for more information.
https://router.hereapi.com/v8/routes?
destination=53.335542,14.522257&
origin=53.338226499,14.5058642048&
transportMode=scooter&
avoid[features]=controlledAccessHighway&
scooter[allowHighway]=true&
apikey={YOUR_API_KEY}
- Use highway as little as possibleSometimes there is no route possible that avoids the highway, for example a route that starts or ends on a highway. In this case, the route will make minimal use of the highway. Furthermore, you need to include a notice (with notice code
violatedAvoidControlledAccessHighway
) to indicate that the route does not avoid the highway. Refer to this tutorial for more information.
https://router.hereapi.com/v8/routes?
destination=53.335542,14.522257&
origin=53.338226499,14.5058642048&
transportMode=scooter&
apikey={YOUR_API_KEY}
Max Scooter Speed
By default, the max scooter speed is 60km/hr or or 16.66 m/s, but you can use the vehicle[speedCap]
parameter to override this speed cap. The units for this parameter are meters per second (m/s). Refer to this tutorial for more information.
The following request sets the maximum scooter speed to 100 km/h or 27.78 m/s.
https://router.hereapi.com/v8/routes?
destination=53.335542,14.522257&
origin=53.338226499,14.5058642048&
transportMode=scooter&
vehicle[speedCap]=27.78&
apikey={YOUR_API_KEY}
Scooter Engine Size
You can change the scooter engine size by overriding this parameter vehicle[engineSizeCc]
, please note that this parameter is still in the Alpha** stage of development. The engine size of the vehicle is in cubic centimeters. Currently, the value is used only in scooter mode. This parameter is utilized to determine if the scooter can be classified as a moped. Scooters with an engine size of less than 51cc are considered mopeds.
**Alpha: This API is in development. It may not be stable and is subject to change. It may have no impact on response. |
The following request sets the scooter engine size to 50cc.
https://router.hereapi.com/v8/routes?
destination=53.335542,14.522257&
origin=53.338226499,14.5058642048&
transportMode=scooter&
vehicle[engineSizeCc]=50&
apikey={YOUR_API_KEY}
Scooter-specific Attributes in the response
You can also add scooter-specific attributes in the response by adding this parameter span=scooterAttributes
. This parameter also requires that the polyline
option is set within the return
parameter. Refer to this tutorial on using the span parameter.
https://router.hereapi.com/v8/routes?
destination=53.335542,14.522257&
origin=53.338226499,14.5058642048&
transportMode=scooter&
span=scooterAttributes&
apikey={YOUR_API_KEY}
Response sample
The following response shows the sample response with a notice code violatedAvoidControlledAccessHighway
to indicate that the route does not avoid the highway. Hence, if the user gets this notice, it is clear that avoiding the highway is not possible and you can take further actions accordingly.
{
"routes": [
{
"id": "85a50dee-a7d2-4383-b3c2-14d65ce9dc6a",
"sections": [
{
"id": "dd8b21b1-5e07-4bb5-992b-a0a196ae2fc5",
"type": "vehicle",
"departure": {
"time": "2020-10-23T09:05:35+02:00",
"place": {
"type": "place",
"location": {
"lat": 53.3382266,
"lng": 14.5058641
},
"originalLocation": {
"lat": 53.3382264,
"lng": 14.5058641
}
}
},
"arrival": {
"time": "2020-10-23T09:11:35+02:00",
"place": {
"type": "place",
"location": {
"lat": 53.3354319,
"lng": 14.5222037
},
"originalLocation": {
"lat": 53.3355419,
"lng": 14.5222569
}
}
},
"notices": [
{
"title": "Violated avoid controlled-access highway.",
"code": "violatedAvoidControlledAccessHighway"
}
],
"transport": {
"mode": "scooter"
}
}
]
}
]
}
Resources
Have your say
Sign up for our newsletter
Why sign up:
- Latest offers and discounts
- Tailored content delivered weekly
- Exclusive events
- One click to unsubscribe