hub/scripts/select_features.py

20 lines
543 B
Python
Raw Permalink Normal View History

2024-12-03 10:40:50 -05:00
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'
2024-12-03 10:40:50 -05:00
gdf = gpd.read_file(geojson_path)
filtered_gdf = gdf[gdf.intersects(bounding_polygon)]
filtered_gdf.to_file("./data/selected_buildings.geojson", driver="GeoJSON")