Calculation of Area using Python program in QGIS

Описание к видео Calculation of Area using Python program in QGIS

Hi Viewers,
From this video, you will know the process of calculation of geometry (area) of polygon features using python program in QGIS.
Find the code below:
d = QgsDistanceArea()
d.setEllipsoid('WGS84')
layer = iface.activeLayer()
features = layer.getFeatures()
for f in features:
geom = f.geometry()
name = f.attribute("Name")
print(name)
print("Area (sq.m):", d.measureArea(geom))
print("Area (km2):", d.convertAreaMeasurement(d.measureArea(geom), QgsUnitTypes.AreaSquareKilometers))
print("Perimeter(m):", d.measurePerimeter(geom))

Комментарии

Информация по комментариям в разработке