I am trying to find MBR area, height, and width for polygon in QGIS. I have tried the below code. coordinate-system is geographic. As per my research for the correct value, I need some QgsPointXY but I do not have a clear idea of how to use them.
Input
for block in active_layer.getFeatures():
geom = block.geometry()
SMBR_geom, SMBR_area, SMBR_angle, SMBR_width, SMBR_height = geom.orientedMinimumBoundingBox()
mbr_area = SMBR_area
mbr_length = SMBR_height
mbr_width = SMBR_width
print(f"mbr_area:",mbr_area)
print(f"mbr_length:",mbr_length)
print(f"mbr_width:",mbr_width)
Output:
mbr_area: 9.001931762626732e-07
mbr_length: 0.0013687640563659897
mbr_width: 0.0006576686259958109
Actual Correct Value
mbr_area: 6878.7192332149
mbr_length: 98.8647855876
mbr_width: 71.6822574966
But this is not correct. What Python code do I need to use for calculating MBR values?