import glob from pyogrio import read_dataframe, write_dataframe from tools.spatial_indexed_intersection import geom_overlay cctv_list_by_region = glob.glob("DATA/refined/geopackage/CCTV_감시영역/*.gpkg") grid = read_dataframe("DATA/refined/geopackage/100x100/100m격자총인구.gpkg") for region in cctv_list_by_region: region_gpkg = read_dataframe(region) region_gpkg = region_gpkg.to_crs(grid.crs) result = geom_overlay(region_gpkg, grid) result = result.dissolve(by="GID").reset_index() result["CCTV_감시영역"] = result['geometry'].area write_dataframe(result, f"DATA/refined/geopackage/CCTV_감시영역_격자/{region.split('/')[-1].split(',')[0]}_격자.gpkg")