2023-12-18 19:09:41 -05:00
|
|
|
from building_selection_tool import BuildingSelectionTool
|
2023-12-15 13:50:41 -05:00
|
|
|
|
2023-12-18 19:09:41 -05:00
|
|
|
selection_tool = BuildingSelectionTool('./data/collinear_clean.geojson')
|
|
|
|
|
2024-01-08 18:13:23 -05:00
|
|
|
# select all buildings within a polygon
|
2023-12-18 19:09:41 -05:00
|
|
|
sample_polygon_coordinates = [[-73.543833, 45.575932],
|
2023-12-15 13:50:41 -05:00
|
|
|
[-73.541834, 45.575245],
|
|
|
|
[-73.542275, 45.574652],
|
|
|
|
[-73.544235, 45.575329],
|
2023-12-18 19:09:41 -05:00
|
|
|
[-73.543833, 45.575932]]
|
2023-12-15 13:50:41 -05:00
|
|
|
|
2023-12-18 19:09:41 -05:00
|
|
|
selection_tool.select_by_polygon(sample_polygon_coordinates)
|
2023-12-15 13:50:41 -05:00
|
|
|
|
2024-01-08 18:13:23 -05:00
|
|
|
# select building by address
|
2023-12-18 19:09:41 -05:00
|
|
|
sample_address = "2155 Rue Guy, Montreal, Quebec"
|
|
|
|
selection_tool.select_by_address(sample_address)
|
2023-12-15 13:50:41 -05:00
|
|
|
|
2024-01-08 18:13:23 -05:00
|
|
|
# select building by [longitude, latitude] coordinate
|
|
|
|
sample_coordinate = [-73.5790796, 45.4972906]
|
|
|
|
selection_tool.select_by_coordinate(sample_coordinate)
|
|
|
|
|
|
|
|
# save selected buildings in geojson format to specified output_file_path
|
2023-12-18 19:09:41 -05:00
|
|
|
output_file_path = "./output_files/sample_output.geojson"
|
|
|
|
selection_tool.save_selected_buildings(output_file_path)
|