In QGIS how can I have more then one coverage layer in Atlas? As is shown in the image below I have multiple city blocks (in a layer), that contain multiple land lots (in a different layer). I wish to generate various maps (like the one in the second image, highlighting a different land lot each time) where Atlas could go first through all the land lots polygons inside a city block, then again in all land lots inside another city block, and etc.
-
Great question! I don't dare to say "That's not possible", so let me just say that so far, I don't know if it's possible at all. Let's hope so and I would be lucky to see an answer on this. I'm not sure but maybe creating a virtual layer that combines both block and land lots and than using this virtual layer as coverage layer could be an option?– BabelCommented Aug 31, 2021 at 19:42
-
1Maybe using the report (docs.qgis.org/3.16/en/docs/user_manual/print_composer/…) could get you there– J.RCommented Sep 1, 2021 at 15:39
2 Answers
I think you can solve this using a single coverage layer (the plots) and then use an expression to set the extent of the map to the bounds of the enclosing block based on the location of the plot.
-
That is what I did with the expression seen here gis.stackexchange.com/a/289688/159239. It's not perfect since the frame around the feature gets very narrowed but for what I needed it suited. So I'm taking this as the answer since there's no "official" way of doing this. Thanks Commented Sep 2, 2021 at 12:45
You can create the combination of the two geometries and use this as coverage layer for your Atlas. There are at least three possibilities to add the features of the two layers. The first (and preferable) one will not create new data and any change in one of the two initial layers is automatically reflected - that comes as close as possible as using two layers as coverage for the atlas:
- Create a Virtual layer that combines your two polygon layers (see here for the query to use).
Use this virtual layer as coverage layer and you're done.
Options 2 and 3 are good to create actual layers in case using the virtual layer should be unstable. However, changes in the initial geometries are not refelcted and new data is generated.
Use Merge vector layers tool.
Use Geometry by expression to create a new layer combining both input polygon layers with the following expression, than run Multipart to singleparts and Delete duplicate geometries.
collect_geometries( aggregate('plot', 'collect', $geometry), aggregate( 'building', 'collect', $geometry) )