WOLFRAM

TravelDirections[{loc1,loc2,}]

generates directions for travel from loc1 to loc2, .

TravelDirections[{loc1,loc2,},"prop"]

gives the property prop of travel directions.

Details and Options

  • The locations loci can be geographic entities, GeoPosition objects, or strings specifying addresses.
  • Possible options include:
  • TravelMethod "Driving"method of transportation to assume
    UnitSystem $UnitSystemunit system to be used in output
  • TravelDirections returns a TravelDirectionsData object, which behaves as a path specification inside GeoGraphics.
  • Possible properties prop to request include:
  • "Dataset"Dataset with maneuvers and other data
    "TravelPath"travel path as a GeoPath primitive
    "ManeuverGrid"grid of maneuvers
    "TravelDistance"total distance to travel
    "TravelTime"total time for travel
  • TravelDirections attempts to find the fastest path between the loci, not taking traffic into account.

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Find directions from New York City to Miami:

Out[1]=1

Show the path as a thick red line:

Out[2]=2

Get instructions as a dataset:

Out[3]=3

Specify a method of transportation, in this case driving by car:

Out[1]=1

Get an estimate of the total travel time:

Out[2]=2

Scope  (5)Survey of the scope of standard use cases

Compute travel instructions between two geographic location entities:

Out[1]=1

Extract a property value:

Out[2]=2

Compute a property value:

Out[1]=1

Use GeoPosition objects to define locations:

Out[1]=1

Compute instructions to travel through a list of locations:

Out[1]=1

Specify locations as addresses:

Out[1]=1

Options  (3)Common values & functionality for each option

TravelMethod  (1)

TravelDirections uses "Driving" as the default method of transportation:

Out[1]=1

Use "Walking" instead:

Out[2]=2

The respective travel paths are different:

Out[3]=3

UnitSystem  (2)

Specify the unit system of the output quantities:

Out[1]=1
Out[2]=2

Extract property values in different unit systems:

Out[1]=1

The default unit system is given by $UnitSystem, usually determined by your location:

Out[2]=2
Out[3]=3

Applications  (1)Sample problems that can be solved with this function

Take major stops of the Camino de Santiago through northern Spain:

Compute travel directions assuming "Walking" as travel method:

Out[2]=2

Draw a map, including markers at the intermediate locations:

Out[3]=3

Estimate the total distance traveled:

Out[4]=4

Estimate the total time spent, not counting any intermediate stops:

Out[5]=5

Properties & Relations  (2)Properties of the function, and connections to other functions

The estimated travel time can also be computed with TravelTime:

Out[1]=1
Out[2]=2

The estimated travel distance can also be computed with TravelDistance:

Out[1]=1
Out[2]=2

Possible Issues  (1)Common pitfalls and unexpected behavior

Traffic restrictions may force different routes when traveling to the locations in reverse order:

Out[2]=2
Out[3]=3
Out[4]=4

Travel distances are different:

Out[5]=5
Wolfram Research (2015), TravelDirections, Wolfram Language function, https://reference.wolfram.com/language/ref/TravelDirections.html.
Wolfram Research (2015), TravelDirections, Wolfram Language function, https://reference.wolfram.com/language/ref/TravelDirections.html.

Text

Wolfram Research (2015), TravelDirections, Wolfram Language function, https://reference.wolfram.com/language/ref/TravelDirections.html.

Wolfram Research (2015), TravelDirections, Wolfram Language function, https://reference.wolfram.com/language/ref/TravelDirections.html.

CMS

Wolfram Language. 2015. "TravelDirections." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TravelDirections.html.

Wolfram Language. 2015. "TravelDirections." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TravelDirections.html.

APA

Wolfram Language. (2015). TravelDirections. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TravelDirections.html

Wolfram Language. (2015). TravelDirections. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TravelDirections.html

BibTeX

@misc{reference.wolfram_2025_traveldirections, author="Wolfram Research", title="{TravelDirections}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/TravelDirections.html}", note=[Accessed: 16-April-2025 ]}

@misc{reference.wolfram_2025_traveldirections, author="Wolfram Research", title="{TravelDirections}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/TravelDirections.html}", note=[Accessed: 16-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_traveldirections, organization={Wolfram Research}, title={TravelDirections}, year={2015}, url={https://reference.wolfram.com/language/ref/TravelDirections.html}, note=[Accessed: 16-April-2025 ]}

@online{reference.wolfram_2025_traveldirections, organization={Wolfram Research}, title={TravelDirections}, year={2015}, url={https://reference.wolfram.com/language/ref/TravelDirections.html}, note=[Accessed: 16-April-2025 ]}