Merge pull request 'Add crs to the geometry importer as a parameter' (#51) from geojson_exporter into main
Reviewed-on: https://nextgenerations-cities.encs.concordia.ca/gitea/CERC/hub/pulls/51
This commit is contained in:
commit
3512d4b1e4
|
@ -26,13 +26,16 @@ class CityGml:
|
|||
extrusion_height_field=None,
|
||||
year_of_construction_field=None,
|
||||
function_field=None,
|
||||
function_to_hub=None):
|
||||
function_to_hub=None,
|
||||
hub_crs=None):
|
||||
self._city = None
|
||||
self._lod = None
|
||||
self._lod1_tags = ['lod1Solid', 'lod1MultiSurface']
|
||||
self._lod2_tags = ['lod2Solid', 'lod2MultiSurface', 'lod2MultiCurve']
|
||||
self._extrusion_height_field = extrusion_height_field
|
||||
self._function_to_hub = function_to_hub
|
||||
if hub_crs is None:
|
||||
hub_crs = 'EPSG:26911'
|
||||
if function_field is None:
|
||||
function_field = 'function'
|
||||
if year_of_construction_field is None:
|
||||
|
@ -80,8 +83,8 @@ class CityGml:
|
|||
self._srs_name = envelope['@srsName']
|
||||
else:
|
||||
# If not coordinate system given assuming hub standard
|
||||
logging.warning('gml file contains no coordinate system assuming EPSG:26911 (North america with 4m error)')
|
||||
self._srs_name = "EPSG:26911"
|
||||
logging.warning(f'gml file contains no coordinate system assuming {hub_crs}')
|
||||
self._srs_name = hub_crs
|
||||
else:
|
||||
# get the boundary from the city objects instead
|
||||
for city_object_member in self._gml['CityModel']['cityObjectMember']:
|
||||
|
|
|
@ -34,9 +34,13 @@ class Geojson:
|
|||
extrusion_height_field=None,
|
||||
year_of_construction_field=None,
|
||||
function_field=None,
|
||||
function_to_hub=None):
|
||||
# todo: destination epsg should change according actual the location
|
||||
self._transformer = Transformer.from_crs('epsg:4326', 'epsg:26911')
|
||||
function_to_hub=None,
|
||||
hub_crs=None
|
||||
):
|
||||
self._hub_crs = hub_crs
|
||||
if hub_crs is None :
|
||||
self._hub_crs = 'epsg:26911'
|
||||
self._transformer = Transformer.from_crs('epsg:4326', self._hub_crs)
|
||||
self._min_x = cte.MAX_FLOAT
|
||||
self._min_y = cte.MAX_FLOAT
|
||||
self._max_x = cte.MIN_FLOAT
|
||||
|
@ -155,7 +159,7 @@ class Geojson:
|
|||
extrusion_height))
|
||||
else:
|
||||
raise NotImplementedError(f'Geojson geometry type [{geometry["type"]}] unknown')
|
||||
self._city = City([self._min_x, self._min_y, 0.0], [self._max_x, self._max_y, self._max_z], 'epsg:26911')
|
||||
self._city = City([self._min_x, self._min_y, 0.0], [self._max_x, self._max_y, self._max_z], self._hub_crs)
|
||||
for building in buildings:
|
||||
# Do not include "small building-like structures" to buildings
|
||||
if building.floor_area >= 25:
|
||||
|
@ -166,7 +170,6 @@ class Geojson:
|
|||
if lod > 0:
|
||||
lines_information = GeometryHelper.city_mapping(self._city, plot=False)
|
||||
self._store_shared_percentage_to_walls(self._city, lines_information)
|
||||
|
||||
return self._city
|
||||
|
||||
def _polygon_coordinates_to_3d(self, polygon_coordinates):
|
||||
|
|
|
@ -23,7 +23,8 @@ class GeometryFactory:
|
|||
height_field=None,
|
||||
year_of_construction_field=None,
|
||||
function_field=None,
|
||||
function_to_hub=None):
|
||||
function_to_hub=None,
|
||||
hub_crs=None):
|
||||
self._file_type = '_' + file_type.lower()
|
||||
validate_import_export_type(GeometryFactory, file_type)
|
||||
self._path = path
|
||||
|
@ -33,6 +34,7 @@ class GeometryFactory:
|
|||
self._year_of_construction_field = year_of_construction_field
|
||||
self._function_field = function_field
|
||||
self._function_to_hub = function_to_hub
|
||||
self._hub_crs = hub_crs
|
||||
|
||||
@property
|
||||
def _citygml(self) -> City:
|
||||
|
@ -44,7 +46,8 @@ class GeometryFactory:
|
|||
self._height_field,
|
||||
self._year_of_construction_field,
|
||||
self._function_field,
|
||||
self._function_to_hub).city
|
||||
self._function_to_hub,
|
||||
self._hub_crs).city
|
||||
|
||||
@property
|
||||
def _obj(self) -> City:
|
||||
|
@ -65,7 +68,8 @@ class GeometryFactory:
|
|||
self._height_field,
|
||||
self._year_of_construction_field,
|
||||
self._function_field,
|
||||
self._function_to_hub).city
|
||||
self._function_to_hub,
|
||||
self._hub_crs).city
|
||||
|
||||
@property
|
||||
def city(self) -> City:
|
||||
|
|
Loading…
Reference in New Issue
Block a user