I'm new to qgis and I want to find the length of some roads in a map. So I used the following code,
from shapely.wkb import loads
layer = qgis.utils.iface.mapCanvas().currentLayer() total = 0 for feature in layer.selectedFeatures(): geom = feature.geometry() wkb = geom.asWkb() line = loads(wkb) total = total + line.length return total
It shows the length in degrees I think. Is there any way to convert the result I got to meters, without changing the CRS of project. I want to do it programatically(without adding new field using field calculator).