車で行くか歩くかを決める
ニューヨークのある美術館から近くにある博物館まで行くのに,車で行くか歩いて行くかを決める.
In[1]:=

museums = {Entity["Museum", "MuseumOfModernArt::nfkn8"],
Entity["Museum", "AmericanMuseumOfNaturalHistory::gf4kv"]};これら2ヶ所の間を移動する経路を,車の場合と歩く場合の両方について計算する.
In[2]:=
drive = TravelDirections[museums, TravelMethod -> "Driving"]Out[2]=

In[3]:=
walk = TravelDirections[museums, TravelMethod -> "Walking"]Out[3]=

両方の経路を比較する.
In[4]:=
GeoGraphics[{GeoMarker[museums], Thick, Red, GeoPath[drive], Blue,
GeoPath[walk]}, GeoRange -> Quantity[1, "Mile"]]Out[4]=

セントラルパークの中を歩いて行った方が距離は短いが,時間は長くかかる.
In[5]:=
{walk["TravelDistance"], walk["TravelTime"]}Out[5]=
In[6]:=
{drive["TravelDistance"], drive["TravelTime"]}Out[6]=