[Qgis-user] Number of vertices
Martin Bain
Martin.Bain at lismore.nsw.gov.au
Sun Apr 23 18:52:05 PDT 2017
Hi Anke,
The asPolyline() function of a geometry returns a list of points. You can then simply get the length of the list:
lyr=iface.activeLayer()
sel=lyr.selectedFeatures()
obj=sel[0].geometry()
verts=obj.asPolyline()
print verts
[(526002,6.81305e+06), (526011,6.81309e+06), (526016,6.81311e+06)]
print len(verts)
3
Cheers,
Martin.
From: Qgis-user [mailto:qgis-user-bounces at lists.osgeo.org] On Behalf Of Anke zur Gölden
Sent: Sunday, 23 April 2017 4:39 PM
To: QGIS User List <qgis-user at lists.osgeo.org>
Subject: [Qgis-user] Number of vertices
Good morning
is there a way to get the number of vertices for a Polyline?
I am looking for the python method to get if possible
thx
Anke
This email is intended for the named recipient only. The information it contains may be confidential. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party or take any action in reliance on it. If you have received this email in error, please contact the sender immediately and delete the message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170424/a57d5cb3/attachment.html>
More information about the Qgis-user
mailing list