# importing QgsGeometry module from qgis.core import QgsGeometry # creating a point geometry with coordinates (10, 20) point_geometry = QgsGeometry.fromPointXY((10, 20)) # printing geometry type and coordinates of the point print(point_geometry.wkt())
# importing QgsGeometry module from qgis.core import QgsGeometry # creating a point geometry with z coordinate value of 5 point_geometry = QgsGeometry.fromPointXYZ((10, 20, 5)) # printing the z coordinate value of the point print(point_geometry.asPoint().z())This code creates a point geometry object with the x, y, and z coordinates of (10, 20, 5) and prints the z coordinate value of the point. Package Library: QGIS Python API (qgis.core)