-3

I have a big shapefile with many features. Then I have a another shape of less size, wich is in the same space that the first shape. I need to get stats (area, %) from the first shape that only match the second shape.

1

1) If second shapefile is not overlapped by first one completly you can do Intersect and then simply get Area of this output feature class and divide it by area of bigger one *100%

2) If second shapefile is overlapped completely just calculate its area and divide it by area of bigger one *100%

-1

Using geopandas and Python for this should work:

import geopandas as gp
import shapely

gf = gp.read_file('path to shapefile')

#create your comparison shape here
comp = shapely.geometry.Polygon(some polygon in here)

gf['area_overlap'] = gf.apply(lambda x: ((x['geometry'].intersection(
comp).area / x['geometry'].area) * 100), axis=1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.