Filtering out buildings with floor area less that 25 square meters

This commit is contained in:
Peter Yefi 2023-03-29 18:22:23 -04:00
parent 143c09dc67
commit a1bc4bc33e
3 changed files with 6 additions and 3 deletions

View File

@ -41,7 +41,7 @@ class City:
self._name = None
self._lower_corner = lower_corner
self._upper_corner = upper_corner
self._buildings = None
self._buildings = []
self._srs_name = srs_name
self._location = None
self._country_code = None

View File

@ -230,7 +230,9 @@ class Geojson:
self._city = City([self._min_x, self._min_y, 0.0], [self._max_x, self._max_y, self._max_z], 'epsg:26911')
for building in buildings:
self._city.add_city_object(building)
# Do not include "small building-like structures" to buildings
if building.floor_area >= 25:
self._city.add_city_object(building)
self._city.level_of_detail.geometry = lod
if lod == 1:
lines_information = GeometryHelper.city_mapping(self._city, plot=False)

View File

@ -141,7 +141,8 @@ class TestGeometryFactory(TestCase):
year_of_construction_field='ANNEE_CONS',
function_field='CODE_UTILI',
function_to_hub=MontrealFunctionToHubFunction().dictionary).city
self.assertEqual(2356, len(city.buildings), 'wrong number of buildings')
# include 25 square meter condition for a building reduces buildings number from 2289 to 2057
self.assertEqual(2057, len(city.buildings), 'wrong number of buildings')
def test_map_neighbours(self):
"""