qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.62k stars 3.01k forks source link

Atlas and Layout Creation improvements #33187

Open AdmiralKew opened 4 years ago

AdmiralKew commented 4 years ago

As someone who uses the Atlas creator quite frequently, it's sometimes a bit of a pain to get everything to fit right when dealing with atlas features of varying shape and size. Sometimes one layout can work with one feature, but the next renders it invalid. I suggest:

Another feature I'd like to add is the option to quickly set margins as guides.

roya0045 commented 4 years ago

You are aware that you can use the attributes of the feature to control such element as the rotation?

AdmiralKew commented 4 years ago

You are aware that you can use the attributes of the feature to control such element as the rotation?

Yes, but such a thing is finicky and time-consuming when you're working with hundreds of individual maps to generate. Sorry for the late reply.

Bernd-Vogelgesang commented 4 years ago

'rotate to fit' in the 'controlled by atlas' rolldown in map properties. What this would do is rotate the map automatically to maximize the space used by the current feature.

Indeed, an automatic function for this will be great. So far I help myself with a model to prepare the data: I use the "minimum oriented bounding box" function, which generates kind of a coverage layer along with an "angle" attribute. This angle can be used to rotate the object so it best fits into your map frame. In the "Map Rotation" of your Atlas, enter

CASE
WHEN (90-"angle")> 0 THEN (90-"angle")
ELSE (180-"angle")
END

This will orient your north most of the time to the right direction and will not flip your objects upside down for landscape oriented pages.

Without this extra layer, one could maybe construct a similar rule based on this expression and other functions, which could do it on the fly: For a start: angle_at_vertex(shortest_line(centroid(oriented_bbox($geometry)), boundary(oriented_bbox($geometry))),0) (found here: https://gis.stackexchange.com/a/352881)