While trying to polygonize the polyline layer in PyQGIS using
processing.runandload("qgis:linestopolygons",explode_path,polygon_path)
command in python console, it does not create polygons corresponding to the line edges. Instead it creates sliver polygons along the curved edges. Why the polygons are not created along the line edges?
On polygonization, the black lines are supposed to be the edges of the created polygons. Instead only few slivers are created along the curved edges(blue polygons).
Answer
Got the exact polygons as desired using the 'Polygonize' algorithm (Processing Toolbox --> QGIS Geoalgorithms --> Polygonize) in the python console.
import processing
polygon_path = "C:\\Documents and Settings\\User\\polygonsFormed.shp"
line_path = "C:\\Documents and Settings\\User\\inputLine.shp"
processing.runandload("qgis:polygonize",line_path,False,False,polygon_path)
No comments:
Post a Comment