<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I'm trying to include the “Clip raster by mask layer” algorithm in a processing model, but I can’t get it to work. What’s weird is that when I run the algorithm by itself (i.e. not as part of a model), it works fine.</div><div class=""><br class=""></div><div class="">Below are the logs of each (when I run it by itself and when I run it as part of a model). From studying these it seems like the only difference (and what seems to be causing the problem) is that when the algorithm is run from within a model the path to the MASK layer isn’t being included in the GDAL command. Anybody have any idea why? Am I doing something wrong? Is it a bug? </div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Phil Ribbens</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><span style="text-decoration: underline;" class="">Running Clip raster by mask layer by itself (works fine)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><div style="margin: 0px;" class="">Processing algorithm…</div><div style="margin: 0px;" class="">AlgorithmDialog</div><div style="margin: 0px;" class="">Input parameters:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco;" class="">{ 'INPUT' : '/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_c893e43e9931410397ab42a423fd9d61/e27038e2ea2f4b42842aaacf3c6bf15c/OUTPUT.tif', 'MASK' : '/Users/philipribbens/Dropbox/work/QGIS plugin for Key-Log/lower_roanoke_subbasin.shp', 'NODATA' : 255, 'ALPHA_BAND' : False, 'CROP_TO_CUTLINE' : True, 'KEEP_RESOLUTION' : False, 'OPTIONS' : '', 'DATA_TYPE' : 0, 'OUTPUT' : '/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_6c6a3f6013994c2eafbaf28a231297a3/44f299a602e34ef8a666e6848ff95658/OUTPUT.tif' }</span></div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">GDAL command:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco;" class="">gdalwarp -ot Byte -of GTiff -cutline "/Users/philipribbens/Dropbox/work/QGIS plugin for Key-Log/lower_roanoke_subbasin.shp" -crop_to_cutline -dstnodata 255.0 /var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_c893e43e9931410397ab42a423fd9d61/e27038e2ea2f4b42842aaacf3c6bf15c/OUTPUT.tif /var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_6c6a3f6013994c2eafbaf28a231297a3/44f299a602e34ef8a666e6848ff95658/OUTPUT.tif</span></div><div style="margin: 0px;" class="">GDAL command output:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco; color: rgb(0, 0, 255);" class="">Copying color table from /var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_c893e43e9931410397ab42a423fd9d61/e27038e2ea2f4b42842aaacf3c6bf15c/OUTPUT.tif to new file. </span></div><div style="margin: 0px;" class=""><span style="font-family: Monaco; color: rgb(0, 0, 255);" class="">Creating output file that is 3642P x 2860L. </span></div><div style="margin: 0px;" class=""><span style="font-family: Monaco; color: rgb(0, 0, 255);" class="">Processing input file /var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_c893e43e9931410397ab42a423fd9d61/e27038e2ea2f4b42842aaacf3c6bf15c/OUTPUT.tif. </span></div><div style="margin: 0px;" class=""><span style="font-family: Monaco; color: rgb(0, 0, 255);" class="">Using internal nodata values (e.g. 255) for image /var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_c893e43e9931410397ab42a423fd9d61/e27038e2ea2f4b42842aaacf3c6bf15c/OUTPUT.tif. </span></div><div style="margin: 0px;" class=""><span style="font-family: Monaco; color: rgb(0, 0, 255);" class="">0...10...20...30...40...50...60...70...80...90...100 - done. </span></div><div style="margin: 0px;" class="">Execution completed in 0.65 seconds</div><div style="margin: 0px;" class="">Results:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco;" class="">{'OUTPUT': <QgsProcessingOutputLayerDefinition {'sink':/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_6c6a3f6013994c2eafbaf28a231297a3/44f299a602e34ef8a666e6848ff95658/OUTPUT.tif, 'createOptions': {'fileEncoding': 'System'}}>}</span></div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Loading resulting layers</div><div style="margin: 0px;" class="">Algorithm 'Clip raster by mask layer' finished</div></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><span style="text-decoration: underline;" class="">Running Clip raster by mask layer as part of a model (doesn’t work)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><div style="margin: 0px;" class=""><div style="margin: 0px;" class="">Processing algorithm…</div><div style="margin: 0px;" class="">AlgorithmDialog</div><div style="margin: 0px;" class="">Input parameters:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco;" class="">{ 'inputrasterlayer' : '/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_c893e43e9931410397ab42a423fd9d61/e27038e2ea2f4b42842aaacf3c6bf15c/OUTPUT.tif', 'maskvectorlayer' : '/Users/philipribbens/Dropbox/work/QGIS plugin for Key-Log/lower_roanoke_subbasin.shp', 'gdal:cliprasterbymasklayer_1:Final clipped raster' : '/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_6c6a3f6013994c2eafbaf28a231297a3/3b9e2df02eca4aa6b8f6476df78cdf9f/gdal:cliprasterbymasklayer_1:Final clipped raster.tif' }</span></div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class=""><span style="color: rgb(0, 0, 255);" class="">Prepare algorithm: gdal:cliprasterbymasklayer_1</span></div><div style="margin: 0px;" class="">Running Clip raster by mask layer [1/1]</div><div style="margin: 0px;" class="">Input Parameters:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco;" class="">{ ALPHA_BAND: False, CROP_TO_CUTLINE: True, DATA_TYPE: 0, INPUT: '/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_c893e43e9931410397ab42a423fd9d61/e27038e2ea2f4b42842aaacf3c6bf15c/OUTPUT.tif', KEEP_RESOLUTION: False, MASK: '/Users/philipribbens/Dropbox/work/QGIS plugin for Key-Log/lower_roanoke_subbasin.shp', NODATA: 255, OPTIONS: '', OUTPUT: '/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_6c6a3f6013994c2eafbaf28a231297a3/3b9e2df02eca4aa6b8f6476df78cdf9f/gdal:cliprasterbymasklayer_1:Final clipped raster.tif' }</span></div><div style="margin: 0px;" class="">GDAL command:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco;" class="">gdalwarp -ot Byte -of GTiff -cutline -crop_to_cutline -dstnodata 255.0 /var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_c893e43e9931410397ab42a423fd9d61/e27038e2ea2f4b42842aaacf3c6bf15c/OUTPUT.tif "/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_6c6a3f6013994c2eafbaf28a231297a3/3b9e2df02eca4aa6b8f6476df78cdf9f/gdal:cliprasterbymasklayer_1:Final clipped raster.tif"</span></div><div style="margin: 0px;" class="">GDAL command output:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco; color: rgb(0, 0, 255);" class="">ERROR 1: Cannot open -crop_to_cutline. </span></div><div style="margin: 0px;" class="">OK. Execution took 0.196 s (1 outputs).</div><div style="margin: 0px;" class=""><span style="color: rgb(0, 0, 255);" class="">Model processed OK. Executed 1 algorithms total in 0.372 s.</span></div><div style="margin: 0px;" class="">Execution completed in 0.41 seconds</div><div style="margin: 0px;" class="">Results:</div><div style="margin: 0px;" class=""><span style="font-family: Monaco;" class="">{'gdal:cliprasterbymasklayer_1:Final clipped raster': <QgsProcessingOutputLayerDefinition {'sink':/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_6c6a3f6013994c2eafbaf28a231297a3/3b9e2df02eca4aa6b8f6476df78cdf9f/gdal:cliprasterbymasklayer_1:Final clipped raster.tif, 'createOptions': {'fileEncoding': 'System'}}>}</span></div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Loading resulting layers</div><div style="margin: 0px;" class=""><span style="color: rgb(255, 0, 0);" class="">The following layers were not correctly generated.</span></div><ul style="margin: 0px;" class=""><li style="color: rgb(255, 0, 0);" class="">/var/folders/10/qfg4mkl127gcxgmpr82tl1xc0000gq/T/processing_6c6a3f6013994c2eafbaf28a231297a3/3b9e2df02eca4aa6b8f6476df78cdf9f/gdal:cliprasterbymasklayer_1:Final clipped raster.tif</li></ul><div style="margin: 0px;" class=""><span style="color: rgb(255, 0, 0);" class="">You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.</span></div></div></div></div></body></html>