hub/select_features.py

20 lines
542 B
Python

import geopandas as gpd
from shapely.geometry import Polygon
points = [
(-73.65522099550455, 45.47216648812992),
(-73.65201191054271, 45.47096942503966),
(-73.65299060423152, 45.46955428052838),
(-73.65532718525228, 45.47041615556808),
(-73.65522099550455, 45.47216648812992)
]
bounding_polygon = Polygon(points)
geojson_path = './data/cerc_cmm_corrected.geojson'
gdf = gpd.read_file(geojson_path)
filtered_gdf = gdf[gdf.intersects(bounding_polygon)]
filtered_gdf.to_file("./data/selected_buildings.geojson", driver="GeoJSON")