1

I created a field to display the whole route of several photos in a point layer in order to be able to visualize them on the map. I try to do so by using this expression:

concat('C:\Users\DIDAC\Documents\CONSULT\EIA OLIVERES CLARAMUNT\treball camp\fotos\IGN\',"file_name")

"file_name" being the name of every photo.

Here's the error message: "syntax error, unexpected Unknown_CHARACTER"

  • 1
    Are you using this expression in the Field Calculator, or typing it directly into the attribute table? – csk Feb 7 at 19:11
2

Backslash characters need to be escaped in qgis expression strings. Replace each backslash in the path with a double backslash '\'.

  • So would the final expression look like concat('C:\\Users\\DIDAC\\Documents\\...? – csk Feb 7 at 21:57
  • Correct. The \ character is used to begin other "special" characters, like a \n = newline character. To get an actual \ literal you need to use `\`. (This is the same rules as Python or SQL languages) – ndawson Feb 7 at 22:40

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.