[QGIS-Developer] Changing the logic for map extents in composer templates?
nyall.dawson at gmail.com
Fri Aug 4 23:50:27 PDT 2017
I've recently been made aware of an issue regarding creating new print
compositions from templates.
Currently, the logic used here is:
1. For all map items in the template, check the stored map extent
2. If this stored extent intersects the full extent of the layers in
the map canvas, then keep it. If not, reset the map item's extent to
match the map canvas.
I think this logic could be refined. The issue is that any project
with a "global" basemap layer (such as a wms/xyz
tiled/QuickMapServices/etc layer) will ALWAYS satisy the "stored
extent intersects the full canvas extent" requirement, so the map
item's extent will never be altered.
Possible solutions I can see are:
1. Change the test to be "if the stored extent has any intersection
with the CURRENT map canvas extent, keep it. Otherwise reset it to the
map canvas extent."
2. (more intrusive, but more flexible) Add a new "template settings"
section to composer map item properties, with a checkbox for "Store
map extent for use in templates". If checked, the stored map extent in
the template will ALWAYS be used for that map. If unchecked, the map's
extent will ALWAYS be reset to match the current canvas extent. It's
an extra setting, but possibly making the logic explicit and visible
to users will actually make this behaviour simpler to understand.
What are other's thoughts?
More information about the QGIS-Developer