Skip to content

Commit 3ab1230

Browse files
committed
Merge pull request #2110 from NaturalGIS/fix_grass7_v_voronoi
[processing] fix GRASS7 v.voronoi output as lines
2 parents 77d68b0 + fab465a commit 3ab1230

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

python/plugins/processing/algs/grass7/Grass7Algorithm.py

+15-19
Original file line numberDiff line numberDiff line change
@@ -401,30 +401,26 @@ def processAlgorithm(self, progress):
401401
if isinstance(out, OutputVector):
402402
filename = out.value
403403
# FIXME: check if needed: -c Also export features without category (not labeled). Otherwise only features with category are exported.
404+
typeidx = \
405+
self.getParameterValue(self.GRASS_OUTPUT_TYPE_PARAMETER)
406+
outtype = ('auto' if typeidx
407+
is None else self.OUTPUT_TYPES[typeidx])
404408
if self.grass7Name == 'r.flow':
405409
command = 'v.out.ogr type=line layer=0 -c -e input=' + out.name + uniqueSufix
406-
command += ' output="' + os.path.dirname(out.value) + '"'
407-
command += ' format=ESRI_Shapefile'
408-
command += ' olayer=' + os.path.basename(out.value)[:-4]
409-
typeidx = \
410-
self.getParameterValue(self.GRASS_OUTPUT_TYPE_PARAMETER)
411-
outtype = ('auto' if typeidx
412-
is None else self.OUTPUT_TYPES[typeidx])
413-
command += ' type=' + outtype
414-
commands.append(command)
415-
outputCommands.append(command)
410+
elif self.grass7Name == 'v.voronoi':
411+
if '-l' in command:
412+
command = 'v.out.ogr type=line layer=0 -c -e input=' + out.name + uniqueSufix
413+
else :
414+
command = 'v.out.ogr -s -e input=' + out.name + uniqueSufix
415+
command += ' type=' + outtype
416416
else:
417417
command = 'v.out.ogr -s -e input=' + out.name + uniqueSufix
418-
command += ' output="' + os.path.dirname(out.value) + '"'
419-
command += ' format=ESRI_Shapefile'
420-
command += ' olayer=' + os.path.basename(out.value)[:-4]
421-
typeidx = \
422-
self.getParameterValue(self.GRASS_OUTPUT_TYPE_PARAMETER)
423-
outtype = ('auto' if typeidx
424-
is None else self.OUTPUT_TYPES[typeidx])
425418
command += ' type=' + outtype
426-
commands.append(command)
427-
outputCommands.append(command)
419+
command += ' output="' + os.path.dirname(out.value) + '"'
420+
command += ' format=ESRI_Shapefile'
421+
command += ' olayer=' + os.path.basename(out.value)[:-4]
422+
commands.append(command)
423+
outputCommands.append(command)
428424

429425
# 4: Run GRASS
430426

0 commit comments

Comments
 (0)