building_selection_tool/main.py

25 lines
933 B
Python

from building_selection_tool import BuildingSelectionTool
selection_tool = BuildingSelectionTool('./data/collinear_clean.geojson')
# select all buildings within a polygon
sample_polygon_coordinates = [[-73.543833, 45.575932],
[-73.541834, 45.575245],
[-73.542275, 45.574652],
[-73.544235, 45.575329],
[-73.543833, 45.575932]]
selection_tool.select_by_polygon(sample_polygon_coordinates)
# select building by address
sample_address = "2155 Rue Guy, Montreal, Quebec"
selection_tool.select_by_address(sample_address)
# 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
output_file_path = "./output_files/sample_output.geojson"
selection_tool.save_selected_buildings(output_file_path)