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 an Action that loads raster layers (.jp2) into the current QGIS window. This action has been working great in version 1.7.4. I have now upgraded to 1.8.0 for many reasons, but the same Action is not working. Here is the Action I have been using: qgis.utils.iface.addRasterLayer("E:\\Projects\\CityTBay\\Imagery\\2008\\%image")

The Action will load an ortho image from the path location specified. The image name is saved in the filed image. When I use this Action in 1.8.0 the following error occurs: E:\Projects\CityTBay\Imagery\2008\%image is not a valid or recognized raster data source.

The Action is using the Python option.

Thanks...

share|improve this question
    
Can you paste the exact code you are using in the action? Have you remembered to use \\ in python for paths? –  Nathan W Oct 17 '12 at 4:15
    
Nathan, here is the code: qgis.utils.iface.addRasterLayer("E:\\Projects\\CityTBay\\Imagery\\2008\\%image") using the Python option. –  Ryan Garnett Oct 17 '12 at 13:04
    
I have tried this on a few other computers and the following error has come back: –  Ryan Garnett Oct 17 '12 at 21:45
add comment

2 Answers

Did you try adding one of the rasters directly? Any chance it's a format that is not supported in the new version? (like .ecw that requires .dlls in the right spot?)

share|improve this answer
    
Yes I did and it loaded fine. I have also tried it on three different computers with the same results. –  Ryan Garnett Oct 17 '12 at 0:00
add comment
up vote 3 down vote accepted

I have found out what the difference is. As of 1.8.0 the inserting of a value from a file adds the following (using Image as the field name): [% "Image" %]

So my original Action would now read like this:

("E:\Projects\CityTBay\Imagery\2008\[% "Image" %]")

Hopes this removes some frustration for future users.

share|improve this answer
    
hmm I didn't think we made that change until after 1.8, maybe not. –  Nathan W Oct 17 '12 at 22:53
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.