3

I am using QGIS 3.22. I wish to add a field that will represent X,Y or Lat Lon values I managed to create a field for X (using $X) and a field for Y (using $Y) but how do I combine them to one field like this: 177852,655321

2 Answers 2

10

You need a string type field, and you need to use pipes (||), like

$x||','||$y

$x and $y you already know, and the pipes concatenate characters. The output could be an integer value, or you can chime in a comma (',') in between to get the notation you want.

0
2

A widely used alternative is:

Concat ($x, ',', $y)

concat : https://docs.qgis.org/3.22/en/docs/user_manual/expressions/functions_list.html#concat

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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