Carpool (HOV/HOT) Lanes Routing with HERE Routing API
![carpool lanes routing](/sites/g/files/odxslz256/files/styles/blog_post_xs/public/2023-09/screenshot_2023-09-25_at_2.08.50_pm.png?itok=-98c5TqD)
HOV, or carpool lanes, are popular among commuters in highly-populated states such as California, New York, Texas, and Virginia – along with cities such as Washington D.C., Seattle, and Atlanta – because they allow vehicles with multiple passengers to use designated lanes for faster travel. In Northern Virginia, for example, a trip on a popular 27-mile stretch of I-95/I-395 where HOV designated lanes exist can cut travel time by half, with some 18,500 people traveling that specific route during peak commuter hours daily.
In this blog, we will discuss how to enable carpool lanes in HERE Routing API, by setting the parameter: allow[hov]
for HOV (High Occupancy Vehicle) lane and allow[hot]
for HOT (High Occupancy Toll).
Allow HOV Lanes
This parameter allow[hov]
specifies whether HOV lanes can be used in the calculation. The default value is false.
An HOV (High Occupancy Vehicle) lane or carpool lane is reserved for carpool usage. A Carpool lane requires a minimum number of passengers in order for the car to use the carpool lane.
Notes:
- This parameter can't be used with 'vehicle[hovOccupancy]'.
- This parameter can be used with
vehicle[occupancy]
. Ifvehicle[occupancy]
is set, then only HOV lanes allowing this number of occupants will be allowed. - In case of violation,
violatedCarpool
notice will be returned.
The following request shows a sample request to the Routing API that allows HOV and sets the vehicle occupancy.
https://router.hereapi.com/v8/routes?
transportMode=car&
origin=52.5308,13.3847&
destination=52.5323,13.3789&
allow[hov]=true&
vehicle[occupancy]=4&
return=summary&
apikey={YOUR_API_KEY}
Allow HOT Lanes
This parameter allow[hot]
specifies whether HOT lanes can be used in the calculation. The default value is false.
HOT (High Occupancy Toll) lanes are HOV lanes where vehicles that do not qualify as high-occupancy are allowed to pass by paying a toll.
Notes:
- This parameter can not be used with
vehicle[occupancy]
. - This parameter can be used with
allow[hov]
. - In case of violation,
violatedCarpool
notice will be returned. - No toll information is returned for HOT lanes since it is dynamic information.
The following request shows a sample request to the Routing API that allows HOV and HOT lanes.
https://router.hereapi.com/v8/routes?
transportMode=car&
origin=52.5308,13.3847&
destination=52.5323,13.3789&
allow[hov]=true&
allow[hot]=true&
return=summary&
apikey={YOUR_API_KEY}
HERE Maps API for Javascript Sample
To implement this on HERE Maps API for Javascript, this is how the code would look like below.
function calculateRouteFromAtoB (platform) {
var router = platform.getRoutingService(null, 8),
routeRequestParams = {
'routingMode': 'fast',
'transportMode': 'car',
'allow[hov]': 'true',
'allow[hot]' : 'true',
'origin': '38.309,-77.466', // Fredericksburg, VA
'destination': '38.900,-77.007', // Washington DC
'return': 'polyline,turnByTurnActions,actions,instructions,travelSummary'
};
router.calculateRoute(
routeRequestParams,
onSuccess,
onError
);
}
The following sample is modified from the Map with Pedestrian Rout from A to B sample to accommodate the parameter changes this sample from the HERE Maps API for Javascript documentation page. You can access the source code from this Github repo.
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