When I edit a vector layer in qgis, I select a lineString using Node Tool and I can see z coordinate of points in "Vertex Editor". In the image,we can see x,y,z coordinates of a list of points. But how can I get z coordinate of a point using pyqgis. In pyqgis, QgsPoint is a two demension point without z coordinate. And QgsPointV2 is a three demension point. When I get features from a VectorLayer and then get geometry from feature, It seems the geometry can only be convert to a two demension geometry (like QgsPoint, QgsPolyline, QgsPolygon). So how to get z coordinate of point.
with QGIS 2.X, you can access to GeometryV2 by doing something like this:
geometryV2 = feature.geometry().geometry()
It's not really straight forward... but it's the way to do it with QGIS 2.X
then you can access to the z value:
i is the index of the vertex
With QGIS 3.X the API has changed. I don't know for the moment how it would works with this version but I guess it's more straightforward!