# Formula for rotating half degree square map/data frames in projected coordinate system so that they look straight?

I am currently developing a map series using ArcPy with ArcGIS Pro. I am not using the Map Series functionality for this because I need to have lots of control over what is on each map sheet, and there are many exceptions to its many rules. Instead of using Map Series functionality I am simply using a search cursor to iterate through the map series index and setting the camera extent of the map frame to each map sheet.

For each map frame only one of three map frames is visible, because there is a map frame for each of the UTM/MGA zones in my "third" of Australia. I use the mean of xMin and xMax of each sheet extent to decide which zone I am in and choose the appropriate map frame to use.

I am using 30 minute (half degree) square map sheets in GDA94, and drawing them in a projected MGA Zone which means they are no longer quite square and depending on where each sheet is in the zone that almost square may be "rotated" slightly. My understanding is that cartographers will usually "straighten" up the map by rotating it slightly. Often this is done by eye but my understanding is that there is a formula that can be used to calculate the amount of rotation that is needed to make each sheet look straight. An example rotation value is `-0.0782913899729035.

Is anyone familiar with the formula that I am trying to describe and able to point me at where I may be able to find details of it for Australia (MGA zones) or globally (UTM zones)?

• I have seen the formula back when I was doing 1:250k mapping (12 years ago), if I still have it it would be in AML. It was basically the average of X top to bottom in projected coordinates to get a trend line for the centre of the map then calculating the angle that line is apparently rotated from normal using Pythagorean calculus. How would you set the rotation of the map frame in python? Commented Apr 12, 2017 at 5:33
• @MichaelMiles-Stimson `Data Frame` object has `rotation` property desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/… Commented Apr 12, 2017 at 5:36
• Yes @AlexTereshenkov but does that rotate the frame on the sheet or the contents of the frame inside the square? Commented Apr 12, 2017 at 5:36
• @MichaelMiles-Stimson I'm thinking that I will use the `heading` property of the `camera` object for the map frame so that it is the contents of the frame that rotates, and then I'll mask the data that falls outside the projected half degree square. Having the formula in AML will be perfect because that and ArcPy/Python are the only programming languages that I am fluent in.
– PolyGeo
Commented Apr 12, 2017 at 5:40
• @MichaelMiles-Stimson Do you have any idea what that formula might be named or described as?
– PolyGeo
Commented Apr 12, 2017 at 5:41

I have not written the code yet but with help from the comments it seems like that may actually be quite straightforward to do. The key hint comes from a comment by @MichaelMiles-Stimson:

It was basically the average of X top to bottom in projected coordinates to get a trend line for the centre of the map then calculating the angle that line is apparently rotated from normal using Pythagorean calculus.

I think the steps that I will use are:

1. Project lat/long values from centre bottom (xCen,yMin) and centre top (xCen,yMax) of the sheet into the appropriate MGA/UTM zone for that sheet.
2. Use Pythagorean theorem to calculate the angle of the line between centre bottom and centre top in MGA/UTM (metre) vazlues.
• I couldn't find the old AML but I do remember a bit more.. on the 250k which are 1 degree tall by 1.5 wide (plus 4 minutes N and 6 minutes E) we used the Y to straighten on the sheet as it's the longest axis. A helpful but unrelated hint is when you create your mask (in DD) it should be densified (vertices in an otherwise straight line) to a few seconds before projecting to your UTM coordinate system so that the shape is more-or-less correct to the graticule; Using a 4 point box will look dodgy when projected. Commented Apr 12, 2017 at 23:05
• @MichaelMiles-Stimson Yeah - I plan to densify the sheet boundary in lat/long before projecting it to use as a mask. I may try to dispense with the mask and just let the map flow to the edges of the extent in metres.
– PolyGeo
Commented Apr 12, 2017 at 23:23
• If you're not masking it would probably look better if you went about an inch on paper outside so it looks intentional, like a bleed edge, as a courtesy to the map user so that if what they're after is 'just outside' the map extent they can still find it; it also helps marry adjacent sheets. But that's wandering off-topic. Commented Apr 12, 2017 at 23:30