Feature request #18670
Map extent based on atlas feature attribute
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Map Composer/Printing | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 26558 |
Description
I am using Atlas on QGIS 2.18.17. The city I am working on is divided by wards and these wards are divided by blocks.
Each page of the atlas is focusing on one block (layer coverage: block.shp).
There is a small map on each page displaying the ward where is located the block. To show the ward where is located the current atlas feature (i.e. the current block) the extents are set as follow:
A: x_min( geometry(get_feature('ward layer','WardName',attribute(@atlas_feature,'WardName'))))
B: y_min( geometry(get_feature('ward layer','WardName',attribute(@atlas_feature,'WardName'))))
C: x_max( geometry(get_feature('ward layer','WardName',attribute(@atlas_feature,'WardName'))))
D: y_max( geometry(get_feature('ward layer','WardName',attribute(@atlas_feature,'WardName'))))
To improve a bit the visibility, I will add a 15% margin around feature as follow:
x_min = A - (C - A) *15%
y_min = B - (D - B) * 15%
etc.
It would be interesting to improve the option "controlled by atlas" by adding an option such as "set extent to another layer than atlas coverage layer".
In my case this would mean: map extent based on each ward boundaries (although atlas coverage layer is block.shp)