# Rotate Geographic map

I want the map to be rotated by -45 Degree. I want to coast to be horizontal (perfect -45 degree). I already have:

loc = GeoPosition[{52.57243, 5.51780}];
loc1 = GeoPosition[{52.57718, 5.52193}];
loc2 = GeoPosition[{52.57449, 5.52636}];
loc3 = GeoPosition[{52.56495, 5.51071}];
loc4 = GeoPosition[{52.56765, 5.50631}];
GeoGraphics[{Red, Thick,GeoPath[{{loc1, loc2}, {loc2, loc3}, {loc3, loc4}, {loc4, loc1}}], GeoStyling["StreetMap"]}, GeoZoomLevel -> 14,GeoScaleBar -> Placed["meters", {Center, Top}], GeoCenter -> loc,GeoRange -> Quantity[2, "Kilometers"]]


I already tried the rotate function which gave unsatisfying results. The code (without rotation) gives the following result:

But I want it to look like this (inluding a -45 degree rotation and where coordinates are still displayed correctly):

I also tried the following which is an edited copy from Mathematica documentation center:

upsidedown = (ImageTransformation[#, RotationTransform[Pi/4], DataRange -> {Automatic, {-1, 1}}] &);
downunder = GeoDisk[loc, Quantity[2, "Kilometers"]];
bestemmingsgebied = GeoPath[{{loc1, loc2}, {loc2, loc3}, {loc3, loc4}, {loc4, loc1}}];

GeoGraphics[{GeoStyling["StreetMap", GeoStylingImageFunction -> upsidedown], downunder, bestemmingsgebied}, GeoBackground -> GeoStyling["StreetMapNoLabels"], GeoCenter -> loc, GeoScaleBar -> Placed["meters", {Center, Top}]]


This results in the following picture:

Unfortunately the box didn't rotate, so is there a way to do this?

Oh btw I'm using version 10.3.

• Dirty work around is to add GeoRangePadding, move GeoScaleBar inside, Rotate result, Rasterize and ImageTake appropriate part.
– Kuba
Jun 6 '16 at 13:28
• Your original map is in the "Mercator" projection, so something you can do to rotate it is to use the "ObliqueMercator" projection. For example, try to add GeoProjection -> {"ObliqueMercator", "Centering" -> {loc, 45}} to your GeoGraphics input.
– jose
Jun 7 '16 at 18:43
• @jose I think it's worth an answer, don't you agree?
– Kuba
Jun 8 '16 at 12:04
• @jose Thanks it works like a charm, Kuba thank you aswell for your reaction! Jun 9 '16 at 5:26
• @jose Yes please enter your comment as an answer. I had been toying with this question for quite some time, to no avail. I'd love to have your suggestion preserved as a proper answer! Jun 9 '16 at 18:01

A possible way to rotate a map is to use the freedom provided by an oblique projection. Obliqueness adds the three degrees of freedom of a general 3D rotation, namely the {lat, lon} coordinates of the new pole and a rotation around that point.

In the future, the WL projection engine will support obliqueness for all projections, but currently some of the projections specifically have the freedom of obliqueness. In this case your original map uses the "Mercator" projection, because it is a low scale map, and the WL has its oblique version, called "ObliqueMercator", both for spherical and for ellipsoidal models. Note that there is also a "TransverseMercator", very important in the UTM family of projections, also available both for spherical and ellipsoidal models.

The idea is to use the projection {"ObliqueMercator", "Centering" -> {p, alpha}}, where p is a point on the new equator and alpha is a rotation in degrees around that point p, positive clockwise as standard with azimuths in geography. Using your definitions, and adding geo grid lines for orientation:

GeoGraphics[{Red, Thick, GeoPath[{loc1, loc2, loc3, loc4, loc1}]},
GeoScaleBar -> Placed["Metric", {Center, Top}], GeoCenter -> loc,
GeoProjection -> {"ObliqueMercator", "Centering" -> {loc, 45}},
GeoGridLines -> Automatic]


• “In the future, the WL projection engine will support obliqueness for all projections”？？
– yode
Jun 10 '16 at 5:41
• @yode, jose is saying that oblique versions of the built-in map projections will eventually be implemented, which will allow arbitrarily oriented maps such as the one in this post, among other things. Jun 10 '16 at 7:56
• Thanks for your response. @J.M. I'm just surprise Mr. jose know the future. :)
– yode
Jun 10 '16 at 7:59
• Ha, ha. I just updated my profile data to explain where I got my crystal ball...
– jose
Jun 10 '16 at 16:06
• Jose, thanks for posting the answer and its explanation. (+1) Jun 13 '16 at 3:43