From f3443acb30479368aa9ffd4453b7b3198de8359a Mon Sep 17 00:00:00 2001 From: guille Date: Mon, 8 Mar 2021 12:05:05 -0500 Subject: [PATCH] CityGML Feeder now auto remove last duplicated point --- imports/geometry_feeders/city_gml.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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])