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
regions = glob.glob("DATA/refined/geopackage/100x100/100m격자총인구.gpkg")
boarder = "DATA/refined/geopackage/2024_05_경북_도로명지도/경북_읍면동_경계.gpkg"
boarder = read_dataframe(boarder)
blind_spot = ("DATA/refined/geopackage/경북읍면동-행정동_음영구역.gpkg")
blind_spot = read_dataframe(blind_spot)
def process_region(under, upper, postfix=""):
print(postfix)
under_name = under
under = read_dataframe(under)
under = under.to_crs(upper.crs)
print(under.crs)
upper_transformed = upper.to_crs(under.crs)
blind_area_by_grid = geom_overlay(upper_transformed, under)
write_dataframe(blind_area_by_grid, f"DATA/refined/geopackage/음영구역_격자/{under_name.split('/')[-1]}{postfix}.gpkg")
process_region(regions[0], blind_spot, "격자")
process_region(regions[0], boarder, "격자_경계")
#
# # Execute the processing in parallel
# results = Parallel(n_jobs=1)(delayed(process_region)(region, blind_spot) for region in regions)
# print("!!!")
# results = Parallel(n_jobs=1)(delayed(process_region)(region, boarder, "경계") for region in regions)