Write how to get the value in meters in latitude and longitude of the layer's coordinate system. It is a value that I think will be a reference value. Please let me know if there is another good way.
QGIS 3.4.4
layer = iface.activeLayer()
crs = layer.crs()
feature = layer.selectedFeatures()[0]
geom = feature.geometry()
print(geom.length())
area = QgsDistanceArea()
area.setEllipsoid(crs.ellipsoidAcronym())
print(area.measureLength(geom))
layer = iface.activeLayer()
crs = layer.crs()
feature = layer.selectedFeatures()[0]
geom = feature.geometry()
area = QgsDistanceArea()
area.setEllipsoid(crs.ellipsoidAcronym())
area.setEllipsoidalMode(True)
print area.measureLength(geom)
QGIS Documentation: QgsDistanceArea stackexchange: QGIS Python Distance between points QgsDistanceArea.convertMeasurement not enough arguments error
Recommended Posts