Skip to main content
2 of 2
added 30 characters in body; edited tags; edited title
Taras
  • 34k
  • 4
  • 73
  • 148

Getting extent (bounds) of each feature using Fiona

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