3

I tried to manually set different scales for different features in atlas generation (QGIS 2.18.16). Thus, I had to switch off map - "controlled via atlas".

The resulting scales were fine, however the shapefiles were not centered anymore, but partly off the map. Any idea how to fix this?

As a workaround I now use the project-wide scales, but they are far from ideal. In the preview I could edit the scale, but it is apparently not saved.

2

Use "Data defined settings" to control the scale of each map.

If you want each map in an atlas to be centered on the atlas feature, you must leave on the option "controlled via atlas."

Step 1: Add an attribute to the atlas-controlling layer called "scale."

enter image description here

Step 2: Use the new scale field to control the scale of the map in the atlas.

enter image description here

  • Wonderful, it worked! – Krisselack Mar 13 '18 at 10:50
1

There's a workaround for this, but it can be laborious if you have a lot of features in your atlas.

  1. For every atlas feature:

    1. Zoom your map view to the feature and set your scale.
    2. Run Vector geometry > Create layer from extent, and use the canvas extent. Make the name of the output corresponds to the feature in question.
  2. Once you've created an extent layer for each feature, you'll run them all through Merge vector layers.

By way of example, here are 4 extent layers I created around Wisconsin Congressional Districts:

merging extents

  1. In your Layout view, choose the newly created merged_vector_layer as your coverage layer, and be sure to check off "Hidden coverage layer". Sometimes, the "hidden" layer can still show depending on the file format you export to. To be safe, make the layer styling completely transparent.

  2. Allow your map scale to be "controlled by atlas" with a margin of 0%.

  3. Export your atlas:

outputs

It is possible, not to mention faster, to simply create polygons in a single layer to begin with, and use those as your coverage layer, but I find that by using the extent-to-polygon feature creates a more consistent, predictable end product.

Also, this creates the problem that your coverage layer no longer holds data relating to the focus of each atlas page, so atlas variables become less useful.

It's a separate issue from your question, but if you cut your extent polygons carefully, you can run a spatial join with the predicate contains to bring your feature attributes into the coverage layer, and you can use the atlas features to make a great end product.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.