Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
    
I just tested this on Ubuntu with QGIS nightly and I cannot reproduce this problem. –  underdark Aug 26 '11 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 Aug 26 '11 at 7:43
add comment

2 Answers 2

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.

share|improve this answer
    
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 Sep 16 '11 at 7:58
add comment

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

"D:\Projects\picture.jpg"

or

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

should fix you right up.

share|improve this answer
    
See comment to underdarks answer. Putting double quotes doesnt work either - it still removes the \ characters from the path. –  James S Sep 16 '11 at 8:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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