I have a shapefile with many large polygons and would like to process each polygon individually because spatial operations on the entire dataset are too big for memory. For instance, iterate shapefile, buffer each polygon, calculate zonal statistics, and store results as a single geodataframe.
Can we iterate through the geopandas dataframe to buffer each polygon separately?
My initial code doesn't appear to update the geodataframe's area after buffering.
import geopandas as gpd #import rasterio fp = r"E:\Polygon_Features.shp" data = gpd.read_file(fp) print(data.area) data_buffer = data.copy() for index, row in data_buffer.iterrows(): row['geometry'] = row['geometry'].buffer(500) print(data_buffer.area)