[GIS] How to rotate QGIS composer map frame to North when using Atlas

print-composerqgisrotate

In QGIS, I'd like to use Atlas in the Print composer to generate a series of maps. However, I'd like each map to be printed with "north up". For example, using the classic projection of the United States (shown below), Washington and Maine end up being "tilted" so that north is not "up" on the page (see example).

Is there a setting in QGIS that will sync/rotate the map canvas to "true north" based on the current "zoom"? I know I can create a new field with a "rotation" value and apply that to the properties of the data frame, but I've got too many features to calculate and populate manually.

US States
Washington

Best Answer

Here is a method I have used, to satisfactory results.

  1. Find the north pole, and copy its coordinates down. The value will depend on the projection you're using.
  2. In your map composer, use the data-defined override on the map's Rotation setting, and enter the following expression:

-degrees( azimuth( centroid( @atlas_geometry ), make_point( pole_x , pole_y )))

Each atlas page should orient toward the pole, or to any point you use for x and y in the expression, for that matter. Below are a few of the outputs from a sample atlas I made to demonstrate this answer. I added a point at the pole for visualization, but it was not required for the process.

output1

output3

output5

Related Question