• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
yjyoon / 경상북도CCTV분석 star
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB
  • Files
  • Commit
  • Branches
경상북도CCTV분석CCTV_감시구역.py
Download as .zip file
File name
Commit message
Commit date
tools
Hello Yona
2024-08-01
CCTV_감시구역.py
Hello Yona
2024-08-01
CCTV_감시구역_격자.gpkg
Hello Yona
2024-08-01
CCTV설치점수산출.py
Hello Yona
2024-08-01
cctv_ratio.py
Hello Yona
2024-08-01
crimin_area_cal.py
Hello Yona
2024-08-01
survillence_area.py
Hello Yona
2024-08-01
건축물대장.py
Hello Yona
2024-08-01
건축물대장2grid.py
Hello Yona
2024-08-01
건축물대장_geocoding.py
Hello Yona
2024-08-01
범죄주의구역_점수산출.py
Hello Yona
2024-08-01
상가2gird.py
Hello Yona
2024-08-01
생활안전지도.py
Hello Yona
2024-08-01
생활안전지도_범죄주의구역_영역계산.py
Hello Yona
2024-08-01
아파트구획_추출.py
Hello Yona
2024-08-01
juni 2024-08-01 383523f Hello Yona UNIX
Raw Open in browser Change history
import pandas as pd import geopandas as gpd from pyogrio import read_dataframe, write_dataframe from shapely.geometry import Point grid_df = read_dataframe('DATA/refined/geopackage/시군구별/중분류_37100_경산시.gpkg', encoding='utf-8') light_df = pd.read_csv("DATA/raw/보안등/경상북도_경산시_보안등정보_20230711.csv", encoding="ms949") grid_df = grid_df.to_crs("epsg:4326") def is_float(x): try: float(x) return True except ValueError: return False valid_lightings_df = light_df[light_df['경도'].apply(is_float) & light_df['위도'].apply(is_float)] valid_lightings_df['geometry'] = valid_lightings_df.apply(lambda row: Point(float(row['경도']), float(row['위도'])), axis=1) valid_lightings_df = gpd.GeoDataFrame(valid_lightings_df, geometry='geometry') buffer_radius = 50 points_buffered = valid_lightings_df.buffer(buffer_radius) valid_lightings_df = points_buffered def calculate_intersection_ratio(polygon, points_buffered): intersections = points_buffered.intersection(polygon) intersection_area = intersections.area.sum() return intersection_area / polygon.area # Apply the function to each polygon grid_df['intersection_ratio'] = grid_df.apply( lambda row: calculate_intersection_ratio(row['geometry'], points_buffered), axis=1 ) write_dataframe(grid_df, "감시비율(100m).gpkg")

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up