diff --git a/imports/geometry_feeders/city_gml.py b/imports/geometry_feeders/city_gml.py index 3b3673ea..2e7561a8 100644 --- a/imports/geometry_feeders/city_gml.py +++ b/imports/geometry_feeders/city_gml.py @@ -127,28 +127,28 @@ class CityGml: @staticmethod def _lod1_solid(o): try: - surfaces = [Surface(s['Polygon']['exterior']['LinearRing']['posList']['#text']) + surfaces = [Surface(CityGml._remove_last_point(s['Polygon']['exterior']['LinearRing']['posList']['#text'])) for s in o['Building']['lod1Solid']['Solid']['exterior']['CompositeSurface']['surfaceMember']] except TypeError: - surfaces = [Surface(s['Polygon']['exterior']['LinearRing']['posList']) + surfaces = [Surface(CityGml._remove_last_point(s['Polygon']['exterior']['LinearRing']['posList'])) for s in o['Building']['lod1Solid']['Solid']['exterior']['CompositeSurface']['surfaceMember']] return surfaces @staticmethod def _lod1_multi_surface(o): - surfaces = [Surface(s['Polygon']['exterior']['LinearRing']['posList']) + surfaces = [Surface(CityGml._remove_last_point((s['Polygon']['exterior']['LinearRing']['posList'])) for s in o['Building']['lod1MultiSurface']['MultiSurface']['surfaceMember']] return surfaces @staticmethod def _lod2_solid_multi_surface(o): - surfaces = [Surface(s['Polygon']['exterior']['LinearRing']['posList']) + surfaces = [Surface(CityGml._remove_last_point(s['Polygon']['exterior']['LinearRing']['posList'])) for s in o['Building']['lod2MultiSurface']['MultiSurface']['surfaceMember']] return surfaces @staticmethod def _lod2_composite_surface(s): - surfaces = [Surface(sm['Polygon']['exterior']['LinearRing']['posList']) + surfaces = [Surface(CityGml._remove_last_point(sm['Polygon']['exterior']['LinearRing']['posList'])) for sm in s['CompositeSurface']['surfaceMember']] return surfaces @@ -156,10 +156,10 @@ class CityGml: def _lod2_multi_surface(s, surface_type): # todo: this need to be changed into surface bounded? try: - surfaces = [Surface(s['Polygon']['exterior']['LinearRing']['posList']['#text'], + surfaces = [Surface(CityGml._remove_last_point(s['Polygon']['exterior']['LinearRing']['posList']['#text']), surface_type=GeometryHelper.gml_surface_to_libs(surface_type))] except TypeError: - surfaces = [Surface(s['Polygon']['exterior']['LinearRing']['posList'], + surfaces = [Surface(CityGml._remove_last_point(s['Polygon']['exterior']['LinearRing']['posList']), surface_type=GeometryHelper.gml_surface_to_libs(surface_type))] return surfaces @@ -173,3 +173,9 @@ class CityGml: else: surfaces = surfaces + CityGml._lod2_multi_surface(s, surface_type) return surfaces + + @staticmethod + def _remove_last_point(points): + array = points.split(' ') + res = " " + return res.join(array[0:len(array) -3])