Construct a Globe Showing All Weather Stations
Construct a Globe Showing All Weather Stations
A globe showing weather station locations throughout the world.
map = Join@@((List@@First@(CountryData[#, "Polygon"] /. (GeoPosition -> Identity)))& /@ CountryData[]);
map = map /. List[a_ ? NumericQ, b_ ? NumericQ] :> List[b, a];coordsToXYZ[list_] := Transpose[{Cos[#[[1]]] * Cos[#[[2]]], Cos[#[[1]]] * Sin[#[[2]]], Sin[#[[1]]]}&@Reverse@Transpose[list * Pi / 180.]];stations = WeatherData[];coords = coordsToXYZ[{QuantityMagnitude@WeatherData[#, "Longitude"], QuantityMagnitude@WeatherData[#, "Latitude"]}& /@ stations];globe = First@ParametricPlot3D[.99 * {Sin[u] Sin[v], Cos[u]Sin[v], Cos[v]}, {u, -π, π}, {v, -π, π}, MaxRecursion -> 4, Axes -> None, PlotStyle -> Opacity[.5], PlotTheme -> "Classic"];Graphics3D[{globe, Black, Line /@ coordsToXYZ /@ map , Red, Point@coords}, Boxed -> False, ImageSize -> Medium, Lighting -> "Neutral"]