gdf['dist_to_centroid'] = gdf.apply(distance_to_centroid, axis=1)
# Example feature: area of each polygon gdf['area'] = gdf.area
# Read the shapefile gdf = gpd.read_file('path/to/your/NepalGSheng.shp')
# Example feature: distance to centroid def distance_to_centroid(row): centroid = row.geometry.centroid return row.geometry.distance(centroid)
gdf['dist_to_centroid'] = gdf.apply(distance_to_centroid, axis=1)
# Example feature: area of each polygon gdf['area'] = gdf.area
# Read the shapefile gdf = gpd.read_file('path/to/your/NepalGSheng.shp')
# Example feature: distance to centroid def distance_to_centroid(row): centroid = row.geometry.centroid return row.geometry.distance(centroid)
Copyright© 2016-2026 by leminhSTORE