How to generate a Mollweide projection of the rotated earth?

I can center an orthographic projection of the earth over New Zealand with

GeoGraphics[GeoProjection -> {"Orthographic", "Centering" -> {-41, 174}}]


However, centering fails for the Mollweide projection:

GeoGraphics[GeoProjection -> {"Mollweide", "Centering" -> {-41, 174}}]


How can I generate a Mollweide projection of the earth centered over New Zealand?

• GeoGraphics[{} , GeoProjection -> {"Mollweide" , "Centering" -> GeoPosition[Entity["Country", "NewZealand"]] } , GeoGridLines -> Automatic , GeoRange -> "World" , GeoCenter -> Entity["Country", "NewZealand"] , ImageSize -> Large ] ?
– Syed
Aug 27, 2022 at 18:52
• @Syed no, what you suggest is a perspective from a point above the equator at New Zealand's longitude. You have only centered the longitude but not the latitude. I want to look at the globe from a point hovering directly above New Zealand, so that New Zealand appears at the center of the map (horizontally and vertically). Aug 27, 2022 at 19:27

Not the most elegant solution, but we can

• Create an Image of earth in the equirectangular projection.
• Transform the pixels of the image so that New Zealand is at the center.
• Use GeoStyling[{"GeoImage", _}] to project this image onto the map.

Here's the rotation transform, which is unnecessarily brute force: geoposition -> spherical coordinates -> Cartesian coordinates -> rotation -> spherical coordinates -> geoposition.

tfunc = FullSimplify[
RotationTransform[α °, {-Sin[β °], Cos[β °], 0}], {α, β} ∈ Reals];

res = Simplify[{π/2 - #1, #2}/Degree & @@
Rest[CoordinateTransform["Cartesian" -> "Spherical",
tfunc[CoordinateTransform["Spherical" -> "Cartesian",
{1, (90 - lat) °, lon °}]]]], {α, β, lat, lon} ∈ Reals];

With[{gp = {Mod[#1 - β, 360, -180], #2} & @@ Reverse[res]},
geoRotate = Compile[
{{α, _Real}, {β, _Real}, {lat, _Real}, {lon, _Real}},
gp,
CompilationTarget -> "C",
RuntimeOptions -> "Speed"
]
];


Image of earth:

im = GeoImage["World", "StreetMapNoLabels",
GeoProjection -> "Equirectangular", ImageSize -> 1024];


Location to center around:

loc = Entity["Country", "NewZealand"];

{x, y} = QuantityMagnitude[LatitudeLongitude[loc], "AngularDegrees"];


Transform to place New Zealand in the center in the equirectangular projection:

im2 = ImageForwardTransformation[im, geoRotate[x, y, #[[2]], #[[1]]] &,
DataRange -> {{-180, 180}, {-90, 90}}]


Mollweide projection:

GeoGraphics["World", GeoProjection -> "Mollweide",
GeoGridLines -> Automatic, ImageSize -> 1024,
GeoBackground -> GeoStyling[{"Image", im2, "Projection" -> "Mollweide"}]
]