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:[email protected]] On Behalf Of Anke zur Gölden Sent: Sunday, 23 April 2017 4:39 PM To: QGIS User List <[email protected]> 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.
_______________________________________________ Qgis-user mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
