Skip to main content
1 of 2
ThomasG77
  • 31.2k
  • 1
  • 55
  • 95

Fiona: get each feature extent (bounds)

I was looking in Fiona to get for each feature its extent but I didn't find how.

I have try to far to do something like below

import fiona

with fiona.open('countries/ne_10m_admin_0_countries.shp', 'r') as source:
    for f in source:
        geom = f['geometry']
        print geom

I was expecting to get a method for this at the f variable level. After some documentation reading, I've seen that f is a pure python record. So at the end, how with Fiona can I get the extent (or bounding box) of each feature geometry?

PS: I already know the pure GDAL/OGR python solution so I expect a Fiona solution please

ThomasG77
  • 31.2k
  • 1
  • 55
  • 95