I am able to query duration-optimized route from MapBox (see below), but how can I query distance-optimized? Maybe there is some attribute I should add?
1 Answers
According to the docs it depends on the used routing profile if the fastest or shortest route is calculated and on what type of way (e.g. highway, sidewalk):
This API supports four different routing profiles:
mapbox/driving-traffic for automotive routing. This profile factors in current and historic traffic conditions to avoid slowdowns. Traffic is available in these supported geographies.
mapbox/driving for automotive routing. This profile shows the fastest routes by preferring high-speed roads, like highways.
mapbox/walking for pedestrian and hiking routing. This profile shows the shortest path by using sidewalks and trails.
mapbox/cycling for bicycle routing. This profile shows routes that are short and safer for cyclists by avoiding highways and preferring streets with bike lanes.
The Mapbox Directions API is powered by the OSRM routing engine. Some background information regarding profiles:
https://github.com/Project-OSRM/osrm-backend/wiki/Profiles
https://github.com/Project-OSRM/osrm-backend/blob/master/docs/profiles.md