メインコンテンツまでスキップ
For the complete documentation index, see llms.txt.

Directions

Turn-by-turn routes between 2-25 waypoints, for driving (with or without live traffic), walking, or cycling, from the Directions API. The electric-vehicle routing parameters (engine=electric and everything under it) aren't exposed. The command also takes the common flags — --username/-u, --token/-t, --profile, --id — described in Shared parameters.

For travel times between every pair of a set of points rather than one route through them, see mapbox matrix.

mapbox directions​

A route through the waypoints in the order given — a route through fixed stops, not a traveling-salesman solve.

Parameters:

ParameterDescription
<routing-profile>Required. mapbox/driving-traffic (accounts for live traffic), mapbox/driving, mapbox/walking, or mapbox/cycling. Sent as typed rather than checked against a list, since some accounts have additional profiles of their own.
<coordinates>Required. 2-25 {longitude},{latitude} pairs, semicolon-separated. The route visits them in this order. A leading - on a longitude isn't mistaken for a flag.
--alternativesReturn up to 2 alternative routes alongside the primary one.
--annotationsSegment-level metadata per leg, comma-separated: distance, duration, speed, congestion, congestion_numeric, maxspeed, closure, state_of_charge. Requires --overview full.
--avoid-maneuver-radiusRadius in meters, 1-1000, around the start point within which to avoid a significant maneuver.
--bearingsAn {angle},{degrees} per waypoint, semicolon-separated, filtering road segments by direction of travel.
--layersA signed integer per waypoint, semicolon-separated, selecting a road layer (Z-order) on a multi-level road.
--continue-straightKeep going straight at an intermediate waypoint rather than u-turning back to it, even if that is faster.
--excludeRoad types or point(lon lat) values to route around, comma-separated: motorway, toll, ferry, unpaved, cash_only_tolls, country_border, state_border, tunnel.
--geometriesRoute geometry format. Defaults to polyline. Values: geojson, polyline, polyline6.
--includeSpecial road types to allow, comma-separated: hov2, hov3, hot.
--overviewHow much geometry detail the response carries. Defaults to simplified. Values: full, simplified, false.
--radiusesMaximum distance in meters each coordinate may snap to the road network, semicolon-separated: a number or unlimited per coordinate.
--approachesWhich side of the road to approach each waypoint from, semicolon-separated: unrestricted or curb per coordinate.
--stepsReturn turn-by-turn instructions. Several parameters below only take effect with this set.
--banner-instructionsReturn banner objects for display. Requires --steps.
--languageThe language of turn-by-turn instructions. Defaults to en. Requires --steps.
--roundabout-exitsSeparate instructions for entering and exiting a roundabout. Requires --steps.
--voice-instructionsReturn SSML-marked-up voice guidance text. Requires --steps.
--voice-unitsUnits for voice instructions. Requires --steps and --voice-instructions. Values: imperial, british_imperial, metric.
--waypointsZero-based indices of the coordinates that get their own arrival instruction. Must include 0 and the last index. Requires --steps.
--waypoints-per-routeNest each route's waypoints under that route instead of once at the top level.
--waypoint-namesA name per waypoint, semicolon-separated, used in its arrival instruction instead of the road name. Requires --steps.
--waypoint-targetsA {longitude},{latitude} drop-off point per waypoint, semicolon-separated, when it differs from the routed-to coordinate. Requires --steps.
--notificationsWhether to return route notification and warning metadata. Values: all, none.
--alley-biasBias the route against (negative) or toward (positive) alleys, -1 to 1. mapbox/driving only.
--arrive-byDesired arrival time, ISO 8601. mapbox/driving only.
--depart-atDeparture time, ISO 8601. For mapbox/driving it drives time-dependent routing; for mapbox/driving-traffic it selects which traffic conditions to route against.
--max-heightVehicle height in meters, 0-10. Defaults to 1.6. mapbox/driving and mapbox/driving-traffic only.
--max-widthVehicle width in meters, 0-10. Defaults to 1.9. mapbox/driving and mapbox/driving-traffic only.
--max-weightVehicle weight in metric tons, 0-100. Defaults to 2.5. mapbox/driving and mapbox/driving-traffic only.
--snapping-include-closuresAllow snapping to roads with a live-traffic closure. mapbox/driving-traffic only.
--snapping-include-static-closuresAllow snapping to roads with a long-term closure. mapbox/driving-traffic only.
--walking-speedWalking speed in meters per second, 0.14-6.94. Defaults to 1.42. mapbox/walking only.
--walkway-biasBias the route against (negative) or toward (positive) walkways and footpaths, -1 to 1. mapbox/walking only.

Examples:

mapbox directions mapbox/driving "-122.42,37.78;-122.45,37.91"
mapbox directions mapbox/driving-traffic "-122.42,37.78;-122.45,37.91" --alternatives
mapbox directions mapbox/walking "-122.42,37.78;-122.43,37.79" \
--steps --geometries geojson --overview full --annotations distance,duration
このpageは役に立ちましたか?