1

I am trying to create Voronoi polygon on point layer of my project. I need to save this new layer as .shp file.

The following is the code I have written in Python console, using QGIS 3.0

import processing
Parameters={ 'INPUT' : 'file:///C:/Test/points.csv?delimiter=,&crs=epsg:4326&xField=Lat&yField=Long', 'BUFFER' : 0, 'OUTPUT' : 'file:///C:/Test/vor.shp' }
processing.run('qgis:voronoipolygons',Parameters)

But I am getting the following error:

enter image description here

Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\tools\general.py", line 84, in run
return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\core\Processing.py", line 190, in runAlgorithm
raise QgsProcessingException(msg)
_core.QgsProcessingException: There were errors executing the algorithm.
3

I realized my mistake: the output path was not correct. The solution is:

import processing
parameters={ 'INPUT' : 'file:///C:/Test/points.csv?delimiter=,&crs=epsg:4326&xField=Lat&yField=Long', 'BUFFER' : 0, 'OUTPUT' : 'C:/Test/demand/Demand.shp' }
processing.run('qgis:voronoipolygons',parameters)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.