# Create a polygon from a list of points points = [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)] polygon = QgsGeometry.fromPolygonXY([points]) # Determine the area of the polygon area = polygon.area() print('The area of the polygon is:', area)
# Create a circle polygon from its center coordinates and radius center = QgsPointXY(5, 5) radius = 5 circle = QgsGeometry.fromPolygonXY([QgsGeometry.createCirclePolygon(center, radius)]) # Determine the bounding box of the circle bbox = circle.boundingBox() print('The bounding box of the circle is:', bbox)This example creates a circular polygon using the "createCirclePolygon" method provided by the QgsGeometry class and then calculates its bounding box using the "boundingBox" method. The package library for the QgsGeometry class is "qgis.core".