Wolfram Language

Enhanced Geo Visualization

Drive to Champaign

Draw the roads from the 300 largest cities in the US to the headquarters of Wolfram Research in Champaign, IL.

In[1]:=
Click for copyable input
champaign = Entity["City", {"Champaign", "Illinois", "UnitedStates"}]
Out[1]=
In[2]:=
Click for copyable input
us = Entity["Country", "UnitedStates"]
Out[2]=

This is the list of the largest cities in the US.

In[3]:=
Click for copyable input
Length[cities = CityData[{Large, "UnitedStates"}]]
Out[3]=

Compute travel paths to Champaign.

In[4]:=
Click for copyable input
roads = Quiet@TravelDirections[{#, champaign}, "TravelPath"] & /@ cities;

Eliminate a few failed cases, like traveling from Honolulu to Champaign.

In[5]:=
Click for copyable input
Length[roads = Cases[roads, _GeoPath]]
Out[5]=

Draw the map.

In[6]:=
Click for copyable input
GeoGraphics[{ GeoStyling[White], Polygon[us], Red, Opacity[.1], roads, Black, Opacity[0.6], Point[cities], Blue, Opacity[1], PointSize[Large], Point[champaign] }, GeoBackground -> LightBlue, ImageSize -> 600, GeoRange -> us] // Rasterize
Out[6]=

Related Examples

de es fr ja ko pt-br ru zh