2

I have a PostGIS table which I have stored the location of some viewpoint photographs. I would like to store the location of the photo file in a field, but when I add a file path in the attribute table dialog in QGIS, QGIS/PostGIS removes '\' and spaces from the path.

Can anyone help me work out why this is? I have done this before without any issues.

If I enter the data through pgAdmin it comes across to QGIS correctly, and I can link to the photographs.

2
  • I just tested this on Ubuntu with QGIS nightly and I cannot reproduce this problem.
    – underdark
    Commented Aug 26, 2011 at 7:18
  • I am using the QGIS-Dev version from OSGeo4W. I just updated it now and the problem is still there when entering data within QGIS. It works fine entering data from pgAdmin.
    – James S
    Commented Aug 26, 2011 at 7:43

2 Answers 2

2

Try double quoting your paths, or escaping your slashes. Either

"D:\Projects\picture.jpg"

or

'D:\\Projects\\picture.jpg'

should fix you right up.

1
  • See comment to underdarks answer. Putting double quotes doesnt work either - it still removes the \ characters from the path.
    – James S
    Commented Sep 16, 2011 at 8:00
0

In attribute table, you have to escape special characters like \ and space. If you have the following path: "C:\temp\my path" then you need to enter

C:\\temp\\my\ path

This way you can also enter new lines "\n" and tabs "\t" into a text field.

1
  • This does work first time around. However, if I go back into the field to edit it again, all of the \ are removed (it forgets I escaped them the first time round), so if I wanted to make any edits I would have to use the escape characters each time (not great for my end users). The only way I have got this working is to use a / character instead of a \ (I found this by making the field a file name rather than a line edit widget. When using this method it puts / in the path. This then works with the evis tool and displays the picture.
    – James S
    Commented Sep 16, 2011 at 7:58

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.