Skip to content

Commit 1a0d0db

Browse files
committedJul 16, 2018
fix exception?
1 parent 92d1cdc commit 1a0d0db

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎python/plugins/processing/algs/qgis/RasterSampling.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ def processAlgorithm(self, parameters, context, feedback):
157157

158158
for n, i in enumerate(source.getFeatures()):
159159

160+
attrs = i.attributes()
161+
160162
if i.geometry().isMultipart():
161163
raise QgsProcessingException(self.tr('''Impossible to sample data
162164
of a Multipart layer. Please use the Multipart to single part
@@ -170,12 +172,12 @@ def processAlgorithm(self, parameters, context, feedback):
170172
point = ct.transform(point)
171173
except QgsCsException:
172174
for b in range(sampled_raster.bandCount()):
173-
attrs.append(
174-
None
175-
)
175+
attrs.append(None)
176+
i.setAttributes(attrs)
177+
sink.addFeature(i, QgsFeatureSink.FastInsert)
178+
feedback.setProgress(int(n * total))
176179
feedback.reportError(self.tr('Could not reproject feature {} to raster CRS').format(i.id()))
177-
178-
attrs = i.attributes()
180+
continue
179181

180182
if sampled_raster.bandCount() > 1:
181183

0 commit comments

Comments
 (0)
Please sign in to comment.