From ef62cc8733684f93cabb4cfae9950dcffb030d0b Mon Sep 17 00:00:00 2001 From: John Truckenbrodt Date: Wed, 2 Mar 2022 19:19:17 +0100 Subject: [PATCH] [vector.boundary] fixed bug --- spatialist/vector.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spatialist/vector.py b/spatialist/vector.py index 46273a3..6a0638f 100644 --- a/spatialist/vector.py +++ b/spatialist/vector.py @@ -804,11 +804,13 @@ def boundary(vectorobject, expression=None, outname=None): major = feat_major.GetGeometryRef() boundary = major.Boundary() - - longest = None - for line in boundary: - if (longest is None) or (line.Length() > longest.Length()): - longest = line + if boundary.GetGeometryName() == 'LINESTRING': + longest = boundary + else: # MULTILINESTRING + longest = None + for line in boundary: + if (longest is None) or (line.Length() > longest.Length()): + longest = line points = longest.GetPoints() ring = ogr.Geometry(ogr.wkbLinearRing)