Bug report #9791
Wrong area in composer with enabled OTF
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | Expressions | ||
Affected QGIS version: | 2.2.0 | Regression?: | No |
Operating System: | all | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 18332 |
Description
Geometry functions "$area", "$perimeter" and probably others always return values in layer map units even if OTF is enabled and project units are different. In same time this functions in Field calculator returns correct result using units of the destination CRS.
To reproduce:- load attached project (layer used EPSG:4326, OTF to EPSG:3857 enabled)
- enable editing and calculate features area using Field calculator
- now open composer "Test_area"
- enable atlas preview and navigate on features
- areas are in degrees instead of meters
Tested on master and 2.2.0
Associated revisions
[composer] Fix area calculation in expressions with OTF (fix #9791)
Adds an argument to QgsExpression::replaceExpressionText to allow
passing an optional QgsDistanceArea to use during calculations.
Ensure that html and label composer items correctly specify this
argument.
History
#1 Updated by Nyall Dawson about 10 years ago
- Status changed from Open to Closed
Fixed in changeset 0cb985465b839ae4a4375bcbf4958c92f704b653.