# import necessary libraries from qgis.core import QgsPoint, QgsGeometry # create a QgsGeometry object geometry = QgsGeometry.fromPointXY(QgsPoint(10, 20)) # convert to a point geometry point_geometry = geometry.asPoint() # print the X and Y coordinates of the point print("X coordinate:", point_geometry.x()) print("Y coordinate:", point_geometry.y())In this example, we create a QgsGeometry object representing a point at coordinates (10, 20). We then use the asPoint method to convert this geometry object to a point geometry. Finally, we print the X and Y coordinates of the point. Package library: qgis.core Overall, the QgsGeometry class provides a wide range of methods to manipulate and analyze geometric data in QGIS, making it a powerful tool for spatial analysis and mapping.