File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
python/plugins/processing/algs/qgis Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -82,12 +82,16 @@ def processAlgorithm(self, progress):
82
82
total = 100.0 / len (features )
83
83
for current , inFeat in enumerate (features ):
84
84
geom = inFeat .geometry ()
85
- point = geom .asPoint ()
86
- x = point .x ()
87
- y = point .y ()
88
- pts .append ((x , y ))
89
- ptNdx += 1
90
- ptDict [ptNdx ] = inFeat .id ()
85
+ if geom .isMultipart ():
86
+ points = geom .asMultiPoint ()
87
+ else :
88
+ points = [ geom .asPoint () ]
89
+ for n , point in enumerate (points ):
90
+ x = point .x ()
91
+ y = point .y ()
92
+ pts .append ((x , y ))
93
+ ptNdx += 1
94
+ ptDict [ptNdx ] = (inFeat .id (), n )
91
95
progress .setPercentage (int (current * total ))
92
96
93
97
if len (pts ) < 3 :
@@ -111,10 +115,14 @@ def processAlgorithm(self, progress):
111
115
attrs = []
112
116
step = 0
113
117
for index in indicies :
114
- request = QgsFeatureRequest ().setFilterFid (ptDict [ids [index ]])
118
+ fid , n = ptDict [ids [index ]]
119
+ request = QgsFeatureRequest ().setFilterFid (fid )
115
120
inFeat = next (layer .getFeatures (request ))
116
121
geom = inFeat .geometry ()
117
- point = QgsPoint (geom .asPoint ())
122
+ if geom .isMultipart ():
123
+ point = QgsPoint (geom .asMultiPoint ()[n ])
124
+ else :
125
+ point = QgsPoint (geom .asPoint ())
118
126
polygon .append (point )
119
127
if step <= 3 :
120
128
attrs .append (ids [index ])
You can’t perform that action at this time.
0 commit comments