Feature request #12939

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

Added by baditaflorin - over 1 year ago. Updated about 1 year ago.

Status:Closed Start Date:06/11/2015
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Field calculator
Target version:Future Release - Nice to have
Platform: Resolution:
Platform version: Pull Request or Patch supplied:No
Status info: Tag:

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 05/04/2014
related to QGIS Application - Feature request #2402: Field calculator can't fill fields with areas in units di... Closed

Associated revisions

Revision 9f772bce29dcb2aa6cee5bfbccb1383c479f70b5
Added by Nyall Dawson about 1 year ago

Add API call for setting preferred distance unit for QgsExpression

(refs #13209, #12939, #4857)

Revision ddbdcf8ab1196e859642b1083e43a1bcd2ae2e14
Added by Nyall Dawson about 1 year 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 dfdcec89223d4167850c7ebbb0af1d65c21135f8
Added by Nyall Dawson about 1 year 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

Updated by Jürgen Fischer over 1 year ago

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

Updated by Giovanni Manghi over 1 year ago

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

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".

Updated by Giovanni Manghi over 1 year 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

Updated by Paolo Cavallini over 1 year 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.

Updated by Jürgen Fischer over 1 year 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.

Updated by Nyall Dawson about 1 year ago

  • Status changed from Open to Closed

Also available in: Atom