I have a QGIS plugin that runs the v.clean algorithm two times (first time snap
, second break
) on a chosen layer:
output = self.dlg.directory.text()
params_snap = {
'input' : input,
'type' : 1,
'tool' : 1,
'threshold' : 0.000095,
'output': output,
'error' : error,
'--overwrite': True,
'GRASS_OUTPUT_TYPE_PARAMETER': 2
}
processing.run('grass7:v.clean', params_snap)
params_break = {
'input': output,
'type': 1,
'tool': 0,
'threshold': 0.1,
'-c': True,
'output': output,
'error': error,
'--overwrite': True,
'GRASS_OUTPUT_TYPE_PARAMETER': 2
}
processing.runAndLoadResults('grass7:v.clean', params_break)
My problem is that after running snap, the created output file is not overwritten. runAndLoadResults
of the break algorithm loads the output file as expected, but without broken lines. So only snap
was applied. Since --overwrite
is True
it should work, or do I miss something?
If I choose another output file for the break algorithm everything runs perfect, so the problem is not the algorithm itself.
As stated in my other question here, a temporary output is not possible for Grass algorithms and therefore no solution.
EDIT: The processing log messages print an error:
2019-01-30T11:59:16 INFO C:\Windows\System32>v.out.ogr -c type="line"
input="output6c3d7544cb524a2486d97aca71a41bc4" output="C:\Users\USER
\Desktop\test.gpkg" format="GPKG" --overwrite
2019-01-30T11:59:16 CRITICAL ERROR 1: A file system object called
'C:\Users\USER\Desktop\test.gpkg' already exists.
So Grass recognizes overwrite, but it does not work. Is this the wrong command, for what I try to achieve? The algorithm help (processing.algorithmHelp("grass7:v.clean")
) gives no information about overwrites. I got the information from the v.clean manual.