samedi 28 février 2015

Use raster memory layer from QGIS processing result


I want to apply subsequent QGIS raster processing algorithms in a python script. I want to use memory layers for intermediate calculation results since I am only interested in the end result.


As described in a previous post, for vector layers this works fine when run in the Python console:



processing.runandload("qgis:intersection", layer1, layer2, "memory:myLayerName")


I can access the "memory:myLayerName" for subsequent calculations.


I'd expect a similar syntax for rasters, but I can't get this (or other functions where a raster is created as an output) to work:



processing.runandload("gdalogr:cliprasterbymasklayer", path_to_raster,
path_to_shape, "", False, False, "", "memory:OutputRaster")


I get an "Oooops! The following output layers could not be open" - error. The processing.log file shows:



'INFO|Sun Mar 01 2015 02:20:52|GDAL execution console output|ERROR 1:
TIFFOpen:memory:temp_layer: Permission denied'


When I replace the "memory:OutputRaster" with r"C:/path/to/out/raster.tif" the code runs. What am I doing wrong?





Aucun commentaire:

Enregistrer un commentaire