1

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...

  • 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
3

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.

  • hmm I didn't think we made that change until after 1.8, maybe not. – Nathan W Oct 17 '12 at 22:53
0

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?)

  • 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

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.