Feature request #12939

make the field calculator compute areas and lengths in units other than map units.

Added by baditaflorin - over 9 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Field calculator
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:21019

Description

For now, you need a faculty and a degree to find out a simple thing, how many kilometers or meters does a way have.

Using field calculator you will find out using $length the length in arc degrees, or the default CRS

The measure tool allows me to see the results in meters, without having to search half of the Internet for a projections that will fit my specific CRS that I should find for Mexico, only to go and work something in Australia, and then i will need another CRS there, because they will not be compatible.

Why not implement something simple. 2015 style, like
$length_km
$length_nautical_mile
$length_mile

and if i will use the standard length it will be the CRS conversion, but 95% of the time, i don't want the CRS conversion, because what would be the advantage of knowing that the road is 0.000043 Arc meters? I am sure somebody wants to know, but i think the majority of people are using wsg84 but they don't care about arc meters, they want to know if that road is 430 meters, or not.


Related issues

Related to QGIS Application - Feature request #10170: Calculations should use the project's CRS, not the layer's Open 2014-05-04
Related to QGIS Application - Feature request #2402: Field calculator can't fill fields with areas in units di... Closed

Associated revisions

Revision 9f772bce
Added by Nyall Dawson over 8 years ago

Add API call for setting preferred distance unit for QgsExpression

(refs #13209, #12939, #4857)

Revision ddbdcf8a
Added by Nyall Dawson over 8 years ago

Fix project unit confusion (pt 2): add project distance unit setting

Adds a new option in project properties to set the units used for
distance measurements. This setting defaults to the units set in
QGIS options, but can then be overridden for specific projects.

The setting is respected for length and perimeter calculations in:
- Attribute table field update bar
- Field calculator calculations
- Identify tool derived length and perimeter values
- Default unit shown in measure dialog

Also adds unit tests to ensure that length and perimeter calculated
by attribute table update bar, field calculator and identify tool
are consistent wrt ellipsoidal calculations and distance units.

(refs #13209, #12939, #2402, #4857, #4252)

Revision dfdcec89
Added by Nyall Dawson over 8 years ago

Fix project unit confusion (pt 3): add area unit settings with a
ton of available area units (eg m2, km2, mi2, ft2, yd2, ha, ac,
etc)

Adds a new option in both the QGIS setting and project properties to
set the units used for area measurements. Just like the distance
setting, this defaults to the units set in QGIS options, but can
then be overridden for specific projects.

The setting is respected for area calculations in:
- Attribute table field update bar
- Field calculator calculations
- Identify tool derived length and perimeter values

Also adds unit tests to ensure that area calculated by attribute table
update bar, field calculator and identify tool are consistent wrt
ellipsoidal calculations and area units.

TODO: make measure tool respect area setting

(refs #13209, #4252 and fixes #12939, #2402, #4857)

History

#1 Updated by Jürgen Fischer over 9 years ago

  • Subject changed from $lenght calculator CRS thing is too complicated to $length calculator CRS thing is too complicated

#2 Updated by Giovanni Manghi over 9 years ago

  • OS version deleted (7)
  • Operating System deleted (windows)
  • Category set to Field calculator
  • Tracker changed from Bug report to Feature request

afaik values are computed in layer CRS, once you know is not difficult to keep it in mind. Values are always in map units (meters, feet, degrees), so for instance computing KM is not that hard... $length/1000.

Said that I agree that the field calculator should have functions to compute values in units other that meter/feet more "easily".

#3 Updated by Giovanni Manghi over 9 years ago

  • Subject changed from $length calculator CRS thing is too complicated to make the field calculator compute areas and lenghts in units other than mao units.

see also #2402 and #10170

#4 Updated by Paolo Cavallini over 9 years ago

  • Subject changed from make the field calculator compute areas and lenghts in units other than mao units. to make the field calculator compute areas and lenghts in units other than map units.

#5 Updated by Jürgen Fischer over 9 years ago

  • Subject changed from make the field calculator compute areas and lenghts in units other than map units. to make the field calculator compute areas and lengths in units other than map units.

#6 Updated by Nyall Dawson over 8 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF