TransWikia.com

PyQGIS: draw layer/feature's bounding box

Geographic Information Systems Asked by Tom Chadwin on April 13, 2021

I want to display a vector layer’s bounding box in a print layout (or possibly a single feature’s bounding box). Does QGIS have anything built-in to achieve this in the renderer/style? Or will I have to load a style/add a symbol layer with bounds($geometry)?

One Answer

bounds($geometry) in a Geometry Generator symbol layer will draw a box round every feature in a layer:

enter image description here

Best I can do for a whole layer with multiple features is a new virtual layer of the extent of the layer:

enter image description here

This should be a lot quicker than my first stab of the bounds of the union:

enter image description here

Answered by Spacedman on April 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP