# How can I show the relative size of two GeoGraphics objects?

I've created a GeoGraphics object from data I collected on a recent trip across part of Michigan, like so:

I'd really like to overlay another country to scale in the center of this image to give a more tangible measure of the length of the path, but I'm running into trouble keeping everything lined up correctly. If I do something like

I just get the portion of the globe that encompasses both my path and the UK:

How can I "move" the to-scale outline of the UK over the outline of my path?

Due to the non-sphericity of the Earth, there is no exact way of rotating a polygon, but the following is a good approximation.

Suppose we want to rotate the UK polygon so that London is moved to Lansing.

sourcePosition = GeoPosition[Entity["City", {"London", "GreaterLondon", "UnitedKingdom"}]];
destinationPosition = GeoPosition[Entity["City", {"Lansing", "Michigan", "UnitedStates"}]];


That means we need to implement these changes in latitude and longitude:

dlat = Latitude[destinationPosition] - Latitude[sourcePosition]
(* Quantity[-8.79021, "AngularDegrees"] *)

dlon = Longitude[destinationPosition] - Longitude[sourcePosition]
(* Quantity[-84.4396, "AngularDegrees"] *)


We will do it in two steps, first changing latitudes along the London meridian and then changing longitudes along the Lansing parallel. This will preserve the north-south orientation of the UK.

axis = FromSphericalCoordinates[{1, Pi/2, -Pi/2 + Normal@Longitude[sourcePosition]}]
(* {-0.00203622, -0.999998, 0} *)

rot = Transpose[RotationMatrix[dlon, {0, 0, 1}].RotationMatrix[dlat, axis]];


Get the points of our polygon of the UK:

sourcePolygon = First@EntityValue[Entity["Country", "UnitedKingdom"], "Polygon"];


Finally perform the rotation (note that we transform with the rot matrix on the right, which explains the use of Transpose above):

destinationPolygon = GeoPosition@GeoPositionXYZ[Dot[#, rot] & /@ First@GeoPositionXYZ[sourcePolygon]];


Now we can plot.

GeoGraphics[{GeoMarker[destinationPosition], Polygon[destinationPolygon]}]


• Absolutely brilliant! Exactly what I was looking for; thank you!! Sep 6, 2016 at 12:41