File name
Commit message
Commit date
import glob
import geopandas as gpd
import pandas as pd
from pyogrio import read_dataframe, write_dataframe
import numpy as np
from tqdm import tqdm
from shapely.geometry import box, MultiPolygon
from joblib import Parallel, delayed
from tools.spatial_indexed_intersection import geom_overlay
road_list_by_region = ["DATA/refined/geopackage/범죄주의구역_격자/*.gpkg"]
base_road = read_dataframe("DATA/refined/geopackage/도로명주소/실폭도로_생활안전도로_0등급_dissolve.gpkg")
for region in road_list_by_region:
region_gpkg = read_dataframe(region)
region_gpkg = region_gpkg.to_crs(base_road.crs)
# reset_index() is to preserve GID, the geometry index provided in the original base_road file
result = region_gpkg.dissolve(by="GID").reset_index()
result["area"] = result['geometry'].area