Feature request #4078

Enable CRS conversion in field calculator

Added by Alister Hood over 13 years ago. Updated about 9 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:Vectors
Pull Request or Patch supplied:No Resolution:fixed/implemented
Easy fix?:No Copied to github as #:14061

Description

When using functions like $x, $y, xat(n) and yat(n) the coordinate is returned in the layer CRS.
It would be useful to also be able to get these in the Project CRS or another specified CRS. I understand this is a very popular ability in Mapinfo ;)

I'm assigning low priority because I think it is currently possible to workaround it by making a copy of the file in the other CRS.

History

#1 Updated by Alister Hood about 13 years ago

  • Pull Request or Patch supplied set to No

this would also apply to the area and length functions

#2 Updated by Giovanni Manghi almost 13 years ago

  • Target version set to Version 1.7.4

#3 Updated by Alister Hood over 12 years ago

Also see #4857: Add unit type to $area calculation

#4 Updated by Giovanni Manghi over 12 years ago

  • Target version changed from Version 1.7.4 to Version 2.0.0

#5 Updated by Pirmin Kalberer about 12 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

#6 Updated by Médéric RIBREUX about 9 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

Hello, bug triage...

there is now a transform function in QGIS expressions that make the CRS conversion. You can use it like this to get the x coordinate of a point converted from EPSG:4326 to EPSG:2154:

x(transform($geometry, 'EPSG:4326', 'EPSG:2154'))

For xat (which is replaced with point_n):

x(transform(point_n($geometry, 3), 'EPSG:4326', 'EPSG:2154'))

I am now closing this feature request as there is a way to make the CRS conversion directly from the expression dialog.

Also available in: Atom PDF