I am adding a number of strings together to create a linestring but as such I need spaces between the initial XY values and the end XY values, plus a comma in between the two halves.

Should result in LINESTRING(97763.88319 434314.9609 , 97620.90369 434175.115) but the space is not recognized like it would be in excel I don't want to make another attribute which only holds a space to then include it as a variable.

This is the expression I used:

concat("LINESTRING(", "X", " ", "Y", " , ", "newX", " " , "newY")

Field calculator

1 Answer 1


You need to use single-quote (') for hardcoded strings and double-quote (") for fields reference:

Try with that:

concat('LINESTRING(', "X", "Y", ' , ' , "new_X", "new_Y", ')')

  • @nashm999 - Don't forget to accept this answer by clicking the green-faded tick on the left-hand side =)
    – Joseph
    Dec 15, 2017 at 13:46

Your Answer

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

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