Skip to content

Commit 9e2286a

Browse files
committed
fix layer mapping in case direct use NOT in a model
1 parent d3144b9 commit 9e2286a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python/plugins/processing/algs/qgis/RasterCalculator.py

+6
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ def mappedNameToLayer(self, lyr, expression, layersDict, context):
214214

215215
nameToMap = lyr.source()
216216

217+
# check if nameToMap is a file
218+
# TODO: what about URI eg for a COG?
219+
if os.path.isfile(nameToMap):
220+
# get only the name without extension and path of the file
221+
nameToMap = os.path.splitext(os.path.basename(nameToMap))[0]
222+
217223
# check for layers directly added in the expression
218224
if (nameToMap + "@") in expression:
219225
layersDict[nameToMap] = lyr

0 commit comments

Comments
 (0)