GDAL-RASTER-CALC(1) GDAL GDAL-RASTER-CALC(1) (NAME) gdal-raster-calc - 3.11. (SYNOPSIS) Usage: gdal raster calc [OPTIONS] ... Positional arguments: -i, --input [.. ] [] [ ] -o, --output [] [ ] Common Options: -h, --help --json-usage JSON --config = [ ] -q, --quiet ( ) [ ] Options: -f, --of, --format, --output-format ("GDALG" ) [ ] --co, --creation-option = [ ] [ ] --overwrite [ ] --append --append [ ] --overwrite --ot, --datatype, --output-data-type . OUTPUT-DATA-TYPE=UInt8|Int8|UInt16|Int16|UInt32|Int32|UInt64|Int64|CInt16|CInt32|Float16|Float32|Float64|CFloat32|CFloat64 --no-check-crs --no-check-extent --propagate-nodata NoData NoData --calc () [.. ] [] --dialect . DIALECT=muparser|builtin (: muparser) --flatten --nodata nodata ('none' 'nan' 'inf' '-inf') Advanced Options: --if, --input-format [ ] [ ] --oo, --open-option = [ ] [ ] (DESCRIPTION) gdal raster calc GDAL . (eager) (lazy) VRT (Virtual Dataset) . GDAL ( ) . A=my_data.tif. ( X .) GDAL 3.12 --dialect builtin C++ VRT ( sum mean min max) . . --no-check-extent . --no-check-crs . GDAL 3.12 gdal pipeline gdal raster pipeline . GDALG ( / ) (GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET)) JSON GDALG . GDALG: GDAL Streamed Algorithm (on-the-fly) . (PROGRAM-SPECIFIC OPTIONS) --calc muparser . ( X[1] + 3) (X + 3). . . X --calc "X+3" --calc "X[1]+3" --calc "X[2]+3" --calc "X[3]+3" . . A B C --calc "A + B + C" --calc "A[1] + B[1] + C[1]" --calc "A[2] + B[2] + C[1]" --calc "A[3] + B[3] + C[1]". --calc "sum(A,B,C)" : --calc "sum(A[1], B[1], C[1]" --calc "sum(A[2], B[2], C[1])" --calc "sum(A[3], B[3], C[1])". --flatten (sum avg min max) . sum(A) sum(A[1], A[2], A[3]) sum(A,C) sum(A[1], A[2], A[3], C[1]) . __ . . A / sum(A) N- . () . . GDAL 3.12 --dialect builtin C++ VRT ( sum mean min max) . sum(k=1) min(propagateNoData=true) interpolate_linear(t0=1,dt=1,t=10)..SS " (Built-in variables)" : o _CENTER_X_: X CRS o _CENTER_Y_: Y CRS o NODATA: NoData . . Example 7 . : / ( EPSG:4326) . --dialect muparser|builtin 3.12 . --calc . muparser . --flatten 3.12 . . muparser ( A) A[1],A[2],...,A[n] . min max sum avg muparser . A B --flatten --calc "avg(A)-avg(B)" --calc "avg(A[1],A[2],A[3])-avg(B[1],B[2],B[3])" --flatten --dialect=builtin --calc mean . -i [=] . --calc . --no-check-extent . . (geotransform) . --no-check-crs . . --nodata 3.12 . NoData . "none" NoData . --nodata gdal raster calc NoData . --propagate-nodata 3.12 . NoData NoData . (STANDARD OPTIONS) --append (subdataset) () . GTiff -- GeoTIFF File Format GPKG -- GeoPackage raster. . --co, --creation-option = (creation option) . GeoTIFF (tiled) . . . --formats . Raster drivers . --if, --input-format / () . . . . . . --oo, --open-option = ( ). . -f, --of, --format, --output-format . : gdal --formats | grep raster | grep rw | sort --ot, --datatype, --output-data-type Byte Int8 UInt16 Int16 UInt32 Int32 UInt64 Int64 CInt16 CInt32 Float32 Float64 CFloat32 CFloat64. --overwrite (overwrite) . gdal . 0 ( ). (EXAMPLES) : gdal raster calc -i "A=file1.tif" -i "B=file2.tif" -i "C=file3.tif" --calc "A+B+C" -o out.tif : gdal raster calc -i "A=file1.tif" -i "B=file2.tif" -i "C=file3.tif" --flatten --calc "avg(A)" --calc "avg(B)" --calc "avg(C)" -o out.tif : gdal raster calc -i "A=file1.tif" -i "B=file2.tif" -i "C=file3.tif" --calc "max(A,B,C)" -o out.tif : NaN gdal raster calc -i "A=input.tif" -o result.tif --calc="A > 0 ? A : NaN" : ( ) gdal raster calc -i A=input1.tif -i B=input2.tif -o result.tif --flatten --calc=mean --dialect=builtin : (aspect) ( GDAL 3.12.1 ) gdal raster calc -i "SLOPE=[ read dem.tif ! slope ]" -i "ASPECT=[ read dem.tif ! aspect ]" -o result.tif --calc "(SLOPE >= 2) ? ASPECT : -9999" --nodata -9999 : _CENTER_Y_ gdal raster calc -i A=input.tif \ --calc="sin(_CENTER_Y_ * 0.0174533)" \ -o output.tif (AUTHORS) Dan Baston (COPYRIGHT) 1998-2026 August 18, 2026 GDAL-RASTER-CALC(1)