[Qgis-user] QgsDistanceArea() confusion
Pal Schmitt
p.schmitt at qub.ac.uk
Wed Nov 18 10:10:53 PST 2015
Dear All,
I am trying to write a plugin but am somewhat lost when it comes to
using the QgsDistanceArea() class.
Assume I have two layers, layerA and layerB in arbitrary CRS.
What is an idiot-proof way of using
d = QgsDistanceArea()
and
dist=d.measureLine(featurefromlayerA,featurefromlayerB)
but always obtain the distance dist in meters?
The gui measurement tool seems to work for me, but the above code seems
to give good results only if both features/layers are transformed to
layer.crs().projectionAcronym()
u'utm'
layer.crs().geographicCRSAuthId()
u'EPSG:4326'
which seems a bit clumsy...
Thanks for any help,
Pal
More information about the Qgis-user
mailing list