Bug report #12827

Wrong length calculation from Python with new geometry classes

Added by Alexander Bruy over 8 years ago. Updated over 8 years ago.

Assignee:Marco Hugentobler
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20922


Method length() of the QgsGeometry class now returns wrong length (namely, 1.0) for line features when used from Python. In same time identify tool and field calculator returns correct values.

Tested with two linear layers, one in projected CRS and second in geographical CRS, using next code:

l = iface.mapCanvas().currentLayer()
for f in l.getFeatures():
    print f.geometry().length()

Same code return correct values with QGIS 2.8

Tested under Linux, self-compiled QGIS master 13d67c0

Associated revisions

Revision e295c1fb
Added by Nyall Dawson over 8 years ago

Fix geometry length and area calculation (fix #12827)


#1 Updated by Giovanni Manghi over 8 years ago

  • Affected QGIS version changed from 2.8.2 to master
  • Target version set to Future Release - High Priority
  • Priority changed from Normal to Severe/Regression

#2 Updated by Nyall Dawson over 8 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF