1

I need to create in a point layer attribute table new fields with the points coordinates converted in different geographic CRS through an expression like:

x(transform($geometry, 'EPSG:xxxxx', 'EPSG:xxxxx'))

Is it possible (and how) to integrate in this expression the function 'to_dms' in order to convert directly the decimal degrees output to DMS degrees?

2

I have a layer in OSGB coordinates (EPSG code 27700) and I can use to_dms(x(transform($geometry,'EPSG:4326','epsg:4326')), 'x', 3) to get a DMS representation of the point coordinates.

For example, I can use this expression in the labelling engine:

enter image description here

and my points get labelled with the DMS longitude, even though their coordinate system is still OSGB metres:

enter image description here

You can use that expression to add a DMS longitude column to the attribute table (and with slight modification, latitude too).

  • Thanks a lot! Your answer solves the problem perfectly – Andrew-63 Dec 11 '18 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.