Wolfram Language

Geo Computation

Drive or Walk?

Decide whether to drive or walk when going from one museum to another in New York.

In[1]:=
Click for copyable input
museums = {Entity["Museum", "MuseumOfModernArt::nfkn8"], Entity["Museum", "AmericanMuseumOfNaturalHistory::gf4kv"]};

Compute travel directions between those two locations, both driving and walking.

In[2]:=
Click for copyable input
drive = TravelDirections[museums, TravelMethod -> "Driving"]
Out[2]=
In[3]:=
Click for copyable input
walk = TravelDirections[museums, TravelMethod -> "Walking"]
Out[3]=

Compare both paths.

In[4]:=
Click for copyable input
GeoGraphics[{GeoMarker[museums], Thick, Red, GeoPath[drive], Blue, GeoPath[walk]}, GeoRange -> Quantity[1, "Mile"]]
Out[4]=

The nice walk through Central Park is shorter, but takes longer.

In[5]:=
Click for copyable input
{walk["TravelDistance"], walk["TravelTime"]}
Out[5]=
In[6]:=
Click for copyable input
{drive["TravelDistance"], drive["TravelTime"]}
Out[6]=

Related Examples

de es fr ja ko pt-br ru zh