I'm new to Python and I'm having some dificulties. I want to create a simple layer with a line in the console of QGIS with Python. How can I do that?
Tell me more
×
Geographic Information Systems Stack Exchange is a question and answer site for
cartographers, geographers and GIS professionals. It's 100% free, no registration required.
|
You must first understand how PyQGIS handles geometry (Geometry Handling) The most important element is the point:
and a line or a segment of line are composed of two points:
So to construct a line:
and with a memory layer (geometry only, without the attributes):
the result is: with 3 points, just add it as a new feature:
and the result is: And with a for loop you can create a line with many segments: |
||||
|