Countries of the World

Introductory Notes

This notebook displays the countries of the world, as defined by the data in the  WorldData package.

Initialization

Off[General::"spell1"];

<< DynamicVisualizer`

<< Miscellaneous`WorldData`

Defining the Countries of the World

\(\(	toXYZ[{lat_, long_}] := \ 
      Module[{θ = N[2\ π\ \ lat]/21600. , \ 
          ϕ = N[2\ π\ long]/21600. }, 

        		{Cos[θ] Cos[ϕ], Cos[θ] Sin[ϕ], 
          Sin[θ]}]; 

    toPolygon[list_List]\  := \ \(Polygon[toXYZ/@#]&\)\ /@list; 

    plotCountry[name_]\  := \ 
      Module[{pts}, 
		pts\  = \ WorldData[name]; 
		
        If[\ Head[pts] == \ List, 

          			{\ Hue[\ Random[]\ ], 
			toPolygon[pts]}
			, 
          Print["No data available for ", name]; 
			{}
			]

        	]; \)\)

Creating the Countries of the World

worldGraphics = Graphics3D[plotCountry/@ World];

\(ClearVisualizer[]; 
Visualize[worldGraphics]\)