Skip to main content
edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Get extents of vector shape features in pythonPyQGIS?

Source Link
Curlew
  • 8.2k
  • 5
  • 37
  • 73

Get extents of vector shape features in python

i am just wondering if it is possible to iterate through vector features and return the extent per feature without clipping the vector shape?

The code looks like this and comes from the PyQgis-Documentation. How can i return the extent of every vector feature in a loop.

provider = vector.dataProvider()
            feat = QgsFeature()
            allAttrs = provider.attributeIndexes()
            provider.select(allAttrs)
            while provider.nextFeature(feat):
                geom = feat.geometry()
                # --> return extent or (xmin,ymin,xmax,ymax) ?