Friday, 1 September 2017

qgis - Concatenating string with space


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



Answer



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", ')')



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...