Merge branch 'add/geopandas/importer' into 'master'

fixed importer and geometr factory issue

See merge request Guille/hub!34
This commit is contained in:
Guillermo Gutierrez Morote 2022-11-18 22:08:18 +00:00
commit feb54b7e68
2 changed files with 6 additions and 5 deletions

View File

@ -58,10 +58,10 @@ class GPandas:
if self._city is None:
self._city = City(self._lower_corner, self._upper_corner, self._srs_name)
for scene_index, bldg in self._scene.iterrows():
geom = bldg.geom
polygon = ShapelyPoly(geom['coordinates'][0])
height = float(bldg['height_mean'])
building_mesh = trimesh.creation.extrude_polygon(polygon, height)
geometry = bldg.geometry
# polygon = ShapelyPoly(geometry['coordinates'][0])
height = float(bldg['height'])
building_mesh = trimesh.creation.extrude_polygon(geometry, height)
trimesh.repair.fill_holes(building_mesh)
trimesh.repair.fix_winding(building_mesh)
year_of_construction = int(bldg['year_built'])

View File

@ -17,7 +17,7 @@ class GeometryFactory:
"""
GeometryFactory class
"""
def __init__(self, file_type, path, data_frame=None):
def __init__(self, file_type, path=None, data_frame=None):
self._file_type = '_' + file_type.lower()
self._path = path
self._data_frame = data_frame
@ -46,6 +46,7 @@ class GeometryFactory:
"""
if self._data_frame is None:
self._data_frame = geopandas.read_file(self._path)
print( self._data_frame )
return GPandas(self._data_frame).city
@property