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

Fiona: get each feature 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
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.

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

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.

Tweeted twitter.com/#!/StackGIS/status/447643719530192896
Source Link
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