diff --git a/hub/city_model_structure/city.py b/hub/city_model_structure/city.py index d157364f..987a47e1 100644 --- a/hub/city_model_structure/city.py +++ b/hub/city_model_structure/city.py @@ -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 diff --git a/hub/imports/geometry/geojson.py b/hub/imports/geometry/geojson.py index 029966c8..41e6eac2 100644 --- a/hub/imports/geometry/geojson.py +++ b/hub/imports/geometry/geojson.py @@ -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) diff --git a/hub/unittests/test_geometry_factory.py b/hub/unittests/test_geometry_factory.py index 457a0e32..42be913b 100644 --- a/hub/unittests/test_geometry_factory.py +++ b/hub/unittests/test_geometry_factory.py @@ -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): """