Function Repository Resource:

GeoGlobe3D

Source Notebook

Display geographical data on an interactive globe

Contributed by: Jesse Friedman

ResourceFunction["GeoGlobe3D"][primitives]

represents a 3D geographical image on a globe.

Details and Options

Using ResourceFunction["GeoGlobe3D"] requires internet connectivity.
ResourceFunction["GeoGlobe3D"] returns a Graphics3D object.
ResourceFunction["GeoGlobe3D"] operates essentially by rasterizing GeoGraphics[primitives,options] and using the output as a texture to be mapped onto a sphere.
ResourceFunction["GeoGlobe3D"] uses the same primitives as GeoGraphics, with the following changes:
Pointdisplays as a 3D Point primitive
GeoMarkerdisplays as a 3D pin marker shape
ResourceFunction["GeoGlobe3D"] uses the same directives as GeoGraphics.
ResourceFunction["GeoGlobe3D"] has the same options as Graphics, with the following additions and changes:
"3DPrimitives"Allwhich supported primitives to render in 3D instead of on the sphere texture
GeoCenterAutomaticwhich position on the globe to show at the center of the final image
PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
"Starfield"Truewhether to show a background of stars behind the globe
"SimulatedSun"Falsewhether to use a realistic, time-accurate sun to light the globe
Some options of GeoGraphics, such as GeoProjection and GeoRange, may have no visible effect on the final image.
The option "3DPrimitives" may be set to All, None, or a list containing any of the following symbols: Point, GeoMarker.
ResourceFunction["GeoGlobe3D"][] is equivalent to ResourceFunction["GeoGlobe3D"][GeoCenterHere]
With "SimulatedSun"True, the date supplied to the first DayHemisphere, NightHemisphere, or DayNightTerminator primitive in primitives is used to calculate the position of the simulated sun. If no such primitive exists, Now is used.
With "SimulatedSun"datespec where datespec is a DateObject, datespec is used to calculate the position of the simulated sun.
ResourceFunction["GeoGlobe3D"][GeoGraphics[primitives,options]] is equivalent to ResourceFunction["GeoGlobe3D"][primitives,options].

Examples

Basic Examples (5) 

Show a globe centered on your current location:

In[1]:=
ResourceFunction["GeoGlobe3D"][]
Out[1]=

Show a globe with a GeoMarker indicating Iceland:

In[2]:=
ResourceFunction["GeoGlobe3D"][
 GeoMarker[Entity["Country", "Iceland"]], GeoCenter -> Here]
Out[2]=

Display a globe showing the illumination of Earth by the Sun right now:

In[3]:=
ResourceFunction["GeoGlobe3D"][{
  Blue, DayNightTerminator[],
  Red, GeoPath["ArcticCircle"], GeoPath["AntarcticCircle"]
  }, GeoCenter -> Here, "SimulatedSun" -> True]
Out[3]=

Show a globe using satellite imagery:

In[4]:=
ResourceFunction["GeoGlobe3D"][GeoBackground -> "Satellite"]
Out[4]=

Display the planet Mars:

In[5]:=
ResourceFunction["GeoGlobe3D"][
 GeoMarker[Entity["SolarSystemFeature", "OlympusMonsMars"]],
 GeoModel -> Entity["Planet", "Mars"],
 GeoCenter -> Entity["SolarSystemFeature", "ClaritasFossaeMars"]
 ]
Out[5]=

Scope (5) 

Show a globe using several types of primitives:

In[6]:=
ResourceFunction["GeoGlobe3D"][{
  Orange, Point[Entity[
    "City", {"London", "GreaterLondon", "UnitedKingdom"}]],
  Pink, Point[GeoPosition[{23, 44}]],
  Red, GeoPath[{Entity[
     "City", {"Tangier", "TangierTetouan", "Morocco"}], Entity["City", {"Amsterdam", "NoordHolland", "Netherlands"}]}],
  Purple, GeoDisk[Entity["City", {"Cairo", "Cairo", "Egypt"}], Quantity[500, "Kilometers"]],
  Green, Polygon@Entity["Country", "Turkey"],
  Blue, Polygon[
   GeoPosition@{Entity["City", {"Dakar", "Dakar", "Senegal"}], Entity["City", {"Khartoum", "Khartoum", "Sudan"}], Entity["City", {"Pretoria", "Gauteng", "SouthAfrica"}]}],
  GeoMarker[Entity["City", {"Longyearbyen", "Svalbard", "Svalbard"}], "Color" -> Yellow]
  }]
Out[6]=

Show a point at the capital of each country in Africa:

In[7]:=
ResourceFunction["GeoGlobe3D"][{
  Red,
  PointSize[Medium],
  Point[EntityClass["Country", "Africa"][
    EntityProperty["Country", "CapitalCity"]]]
  }, GeoCenter -> Entity["GeographicRegion", "Africa"]]
Out[7]=

Convert a GeoGraphics object to GeoGlobe3D:

In[8]:=
GeoGraphics[{Green, Polygon[Entity["Country", "UnitedStates"]]}]
Out[8]=
In[9]:=
ResourceFunction["GeoGlobe3D"][%]
Out[9]=

Show a 3D relief map of Earth:

In[10]:=
ResourceFunction["GeoGlobe3D"][
 GeoBackground -> GeoStyling["ReliefMap"]]
Out[10]=

Use a custom tile server:

In[11]:=
ResourceFunction["GeoGlobe3D"][
 GeoServer -> "http://a.tile.openstreetmap.org/`1`/`2`/`3`.png"]
Out[11]=

Options (9) 

3DPrimitives (3) 

By default, GeoMarker and Point primitives are handled specially, rendering as 3D objects instead of as part of the 2D texture mapped onto the sphere:

In[12]:=
ResourceFunction["GeoGlobe3D"][{
  GeoMarker[Entity["Country", "Panama"], "Color" -> Blue],
  Red, Point[Entity["City", {"Nome", "Alaska", "UnitedStates"}]],
  Green, Point[GeoPosition[{63, 100}]]
  },
 GeoCenter -> Entity["City", {"SanFrancisco", "California", "UnitedStates"}]]
Out[12]=

Force all primitives to render as part of the texture:

In[13]:=
ResourceFunction["GeoGlobe3D"][{
  GeoMarker[Entity["Country", "Panama"], "Color" -> Blue],
  Red, Point[Entity["City", {"Nome", "Alaska", "UnitedStates"}]],
  Green, Point[GeoPosition[{63, 100}]]
  },
 GeoCenter -> Entity["City", {"SanFrancisco", "California", "UnitedStates"}],
 "3DPrimitives" -> None]
Out[13]=

Force only some primitives to render as part of the texture:

In[14]:=
ResourceFunction["GeoGlobe3D"][{
  GeoMarker[Entity["Country", "Panama"], "Color" -> Blue],
  Red, Point[Entity["City", {"Nome", "Alaska", "UnitedStates"}]],
  Green, Point[GeoPosition[{63, 100}]]
  },
 GeoCenter -> Entity["City", {"SanFrancisco", "California", "UnitedStates"}],
 "3DPrimitives" -> {Point}]
Out[14]=

GeoCenter (1) 

Center the globe on the Royal Observatory in England:

In[15]:=
ResourceFunction["GeoGlobe3D"][
 GeoCenter -> Entity["AstronomicalObservatory", "Greenwich"]]
Out[15]=

Starfield (2) 

By default, a starfield is rendered behind the globe:

In[16]:=
ResourceFunction["GeoGlobe3D"][]
Out[16]=

Disable the starfield:

In[17]:=
ResourceFunction["GeoGlobe3D"]["Starfield" -> False]
Out[17]=

SimulatedSun (3) 

Show the illumination of Earth by the Sun right now:

In[18]:=
ResourceFunction["GeoGlobe3D"][GeoCenter -> Here, "SimulatedSun" -> True]
Out[18]=

Show the illumination of Earth by the Sun at a certain point in time:

In[19]:=
ResourceFunction["GeoGlobe3D"][GeoCenter -> Here, "SimulatedSun" -> DateObject[{1969, 7, 21, 22, 56}, "Minute", "Gregorian", -4.`]]
Out[19]=

With "SimulatedSun"Automatic, the date of the first DayHemisphere, NightHemisphere, or DayNightTerminator primitive in the graphic is used, if one is present:

In[20]:=
ResourceFunction[
 "GeoGlobe3D"][{Red, DayNightTerminator[
   DateObject[{1988, 6, 23, 12, 0, 0}, "Instant", "Gregorian", -4.`]]}, GeoCenter -> Entity["City", {"SantaClara", "California", "UnitedStates"}], "SimulatedSun" -> Automatic]
Out[20]=

Properties and Relations (3) 

The resource function GeoGraphics3D provides similar functionality to GeoGlobe3D:

In[21]:=
Grid[{{Labeled[
    ResourceFunction["GeoGlobe3D"][
     GeoCenter -> GeoPosition[{45, 135}]], "GeoGlobe3D"], Labeled[ResourceFunction["GeoGraphics3D"][{}, SphericalRegion -> True], "GeoGraphics3D"]}}]
Out[21]=

Geographic positions with nonzero elevation are displayed in the appropriate position relative to Earth’s surface:

In[22]:=
ResourceFunction[
 "GeoGlobe3D"][{Red, Point[Table[
    GeoPosition[{lat, 90, Quantity[lat*5, "Miles"]}], {lat, -90, 90, 10}]]}, GeoCenter -> GeoPosition[{0, 0}]]
Out[22]=

In 2D map projections, Tissot's indicatricies vary in area, shape, or both:

In[23]:=
indicatrixMap = GeoGraphics[{
    Orange,
    GeoStyling[Opacity[1]],
    Table[
     GeoDisk[GeoPosition@{lat, lon}, Quantity[350, "Miles"]], {lat, -90, 90, 30}, {lon, -180, 179, 30}]
    }, GeoCenter -> Here];
GraphicsRow[
 Show[indicatrixMap, GeoProjection -> #] & /@ {"Mercator", "Mollweide", "WinkelTripel"}, ImageSize -> Full]
Out[23]=

On a sphere, all of the indicatrices are identical:

In[24]:=
ResourceFunction["GeoGlobe3D"][indicatrixMap, GeoCenter -> Here]
Out[24]=

Possible Issues (6) 

Labels that are part of the map style may become unreadable near the poles, as they are distorted when the texture is mapped onto the sphere:

In[25]:=
ResourceFunction["GeoGlobe3D"][GeoCenter -> GeoPosition["SouthPole"], ImageSize -> Medium]
Out[25]=

Use GeoBackgroundGeoStyling["StreetMapNoLabels"] to disable the labels on the default map style:

In[26]:=
ResourceFunction["GeoGlobe3D"][GeoCenter -> GeoPosition["SouthPole"], GeoBackground -> GeoStyling["StreetMapNoLabels"], ImageSize -> Medium]
Out[26]=

Some geographical primitives vary in thickness with latitude, as they are distorted when the texture is mapped onto the sphere:

In[27]:=
ResourceFunction[
 "GeoGlobe3D"][{Red, Thick, Line[{GeoPosition["NorthPole"], GeoPosition["SouthPole"]}]}, GeoCenter -> GeoPosition[{45, 0}]]
Out[27]=

As most primitives are rendered to an image which is mapped onto the globe, certain interactive functionality will not work:

In[28]:=
ResourceFunction[
 "GeoGlobe3D"][{Green, Tooltip[Polygon[Entity["Country", "UnitedStates"]], "This tooltip doesn't work"]}]
Out[28]=

The "SimulatedSun" option does not support astronomical bodies other than Earth:

In[29]:=
ResourceFunction["GeoGlobe3D"][GeoModel -> Entity["Planet", "Mars"], "SimulatedSun" -> Now]
Out[29]=

GeoGlobe3D produces a sphere, which does not reflect the eccentricity of the Earth ellipsoid:

In[30]:=
ResourceFunction["GeoGlobe3D"][GeoCenter -> GeoPosition[{0, 0}]]
Out[30]=

This eccentricity is essentially invisible at planet-scale:

In[31]:=
Graphics3D[
 Ellipsoid[{0, 0, 0}, QuantityMagnitude[
    GeodesyData["ITRF00", #] & /@ {"SemimajorAxis", "SemiminorAxis"}][[{1, 1, 2}]]], ViewPoint -> Front]
Out[31]=

The "SimulatedSun" option does not take into account the shadow of Earth’s moon during a solar eclipse:

In[32]:=
eclipseDate = DateObject[{2017, 8, 21}];
ResourceFunction["GeoGlobe3D"][GeoCenter -> GeoPosition[{40, -88}], "SimulatedSun" -> SolarEclipse[eclipseDate]]
Out[32]=

The total and partial phases of an eclipse can be plotted directly onto the globe using the "GraphicsData" property of SolarEclipse:

In[33]:=
ResourceFunction["GeoGlobe3D"][
 SolarEclipse[eclipseDate, "GraphicsData"], GeoCenter -> GeoPosition[{40, -88}]]
Out[33]=

Interactive Examples (2) 

Make a spinning Earth animation using the resource function SpinShow:

In[34]:=
ResourceFunction["SpinShow"][
 ResourceFunction["GeoGlobe3D"][GeoBackground -> "Satellite"]]
Out[34]=

Show how the Antarctic is in day-long sunlight during the summer:

In[35]:=
Manipulate[
 With[
  {date = DatePlus[DateObject[{2019}, "Hour"], {hour, "Hours"}]},
  ResourceFunction["GeoGlobe3D"][
   {White, DayNightTerminator[date]},
   GeoCenter -> GeoPosition["SouthPole"],
   GeoBackground -> "Satellite",
   "SimulatedSun" -> date
   ]
  ], {hour, 0, 24}]
Out[35]=

Neat Examples (4) 

Display the current positions of the members of the Iridium satellite constellation:

In[36]:=
ResourceFunction[
 "GeoGlobe3D"][{Red, PointSize[Medium], Point@EntityClass["Satellite", "IridiumSatellites"]}, GeoBackground -> "Satellite"]
Out[36]=

Show where sunrise is happening right now:

In[37]:=
ResourceFunction["GeoGlobe3D"][
 GeoCenter -> GeoPosition[{0, 1/Quantity[24, "Hours"] DateDifference[Now, Sunrise[GeoPosition[{0, 0}]], "Hours"]*
     Quantity[360, "AngularDegrees"]}],
 "SimulatedSun" -> Now
 ]
Out[37]=

On a 2D map, a geodesic may not appear to be the shortest flight path between two locations:

In[38]:=
airports = {Entity["Airport", "KJFK"], Entity["Airport", "EGLL"]};
Labeled[GeoGraphics[{
   Red, Line[airports],
   Green, GeoPath[airports, "Geodesic"]
   }, GeoProjection -> "Equirectangular"], SwatchLegend[{Green, Red}, {"Geodesic", "Straight line (in equirectangulaar projection)"}]]
Out[38]=

Plotting the paths on a globe makes clear that the geodesic is shorter:

In[39]:=
% /. g_GeoGraphics :> ResourceFunction["GeoGlobe3D"][g]
Out[39]=

Show a rhumb line (loxodrome) spiraling towards the North Pole:

In[40]:=
ResourceFunction[
 "GeoGlobe3D"][{Red, GeoPath[{Here, Quantity[80000, "Kilometers"], 85}, "Rhumb"]}, GeoCenter -> Here]
Out[40]=

Publisher

Jesse Friedman

Version History

  • 1.0.0 – 18 October 2019

Related Resources

License Information