HERE Technologies LogoHERE
HERE Technologies LogoHERE
HERE Technologies LogoHERE
APIs

3 min read

18 September 2023

Pedestrian Routing with HERE Routing API

screenshot 2023 09 21 at 3.03.57 pm.png

Pedestrian routing, also known as walking or footpath navigation, plays a pivotal role in modern urban life. As our cities grow more complex and interconnected, finding the optimal path on foot becomes increasingly important for both residents and visitors. Whether you're exploring a new city, commuting to work, or simply taking a leisurely stroll, efficient and safe pedestrian routing is essential. 

This blog will delve into the world of pedestrian routing by HERE Routing API.

Transport Mode: Pedestrian

To use pedestrian routing, set transportMode=pedestrian. The default speed is 1 meter per second / 3.6 kilometers per hour / 2.23 miles per hour. Or the running or hiking speed equivalent, it is 26.8 minutes per mile or 16.67 minutes per kilometer. Below is the sample request using the default speed. Refer to this tutorial for more information. 

https://router.hereapi.com/v8/routes?
origin=52.547019,13.328605&
transportMode=pedestrian&
destination=52.495002,13.501983&
return=summary&
apikey={YOUR_API_KEY}

Walking Speed

As not everyone walks at the same pace, you can adjust the walk speed in the request, by means of the pedestrian[speed] parameter. The unit is in meters per second. Refer to this tutorial for more information. 

https://router.hereapi.com/v8/routes?
origin=52.547019,13.328605&
transportMode=pedestrian&
destination=52.495002,13.501983&
pedestrian[speed]=2&
return=summary&apikey={YOUR_API_KEY}

Response Sample

{
"routes": [
{
"id": "e9f1997b-81ea-4b1c-9441-73f9b8dddcb0",
"sections": [
{
"id": "1ad0c672-60bd-4be5-baa9-336959bdc411",
"type": "pedestrian",
"departure": {
"place": {
"type": "place",
"location": {
"lat": 52.546886,
"lng": 13.328481
},
"originalLocation": {
"lat": 52.54702,
"lng": 13.328605
}
}
},
"arrival": {
"place": {
"type": "place",
"location": {
"lat": 52.49493,
"lng": 13.501934
},
"originalLocation": {
"lat": 52.495003,
"lng": 13.501983
}
}
},
"summary": {
"duration": 7645,
"length": 14798
},
"transport": {
"mode": "pedestrian"
}
}
]
}
]
}

HERE Maps API for Javascript Sample

To implement this on HERE Maps API for Javascript, this is how the code would look like below.

var platform = new H.service.Platform({
apikey: window.apikey
});
function calculateRouteFromAtoB (platform) {
var router = platform.getRoutingService(null, 8),
routeRequestParams = {
routingMode: 'fast',
transportMode: 'pedestrian',
origin: '51.51326,-0.0968752', // St Paul's Cathedral
destination: '51.5081,-0.0985', // Tate Modern
return: 'polyline,turnByTurnActions,actions,instructions,travelSummary'
};
router.calculateRoute(
routeRequestParams,
onSuccess,
onError
);
}

The following is the sample, Map with Pedestrian Rout from A to B, from the HERE Maps API for Javascript documentation page. You can access the source code from this Github repo

Resources

Portrait of Erwin Soekianto

Erwin Soekianto

Developer Evangelist

Share article

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts

  • Tailored content delivered weekly

  • Exclusive events

  • One click to unsubscribe