New answers tagged

1 vote

Cropping raster layer using QGIS?

A quick update to @Simbamangu's answer as of 2022. In the current version of QGIS (I use 3.2x) click menu item Raster -> Extraction -> Clip Raster by Extent. In the tool window that opens ...
0 votes

Flow Direction tool outputs strange raster that doesn't work with subsequent hydrology tools

If you want to have exactly a flow direction raster with 8 numbers from 1 to 128, you should use the "fill" tool for your inverted DEM, then use the resulting raster as input for the "...
0 votes

Not sure why I am getting a raster error (Error 000732) when incorporating parameter weights in my raster calculation?

In the model, set your weight parameters as a numeric type, either floating point (double type) or integer (long type). In the raster calculator, cast your weights to numeric using float("%weight ...
  • 55.6k
1 vote
Accepted

Combinations and calculations with raster data in QGIS

It seems that in QGIS this is a 3-step job: use Cell statistics from Processing toolbar to calculate MINIMUM from 12 monthly raster layers (see screenshot of the tool below) analogically MAXIMUM ...
  • 1,044
0 votes

Normalize raster in R

The first answer did not work for me: nx <- minmax(accstack) ##accstack is a 1.6Gb tiff file imported as SpatRaster Warning message: [minmax] min and max values not available. See 'setMinMax' or ...
  • 11
0 votes

Merge raster layers with NoData cells

Copy of this answer: https://gis.stackexchange.com/a/425197/92995 In QGIS/processing, use the GRASS tool "r.series". As "Aggregate operation" choose "average"/"...
  • 101
1 vote

Summing two rasters of different extents in QGIS

Make sure both rasters are in the same CRS. The trick to get the whole extent is to create a virtual raster. In case the initial rasters contain nodata values, use Fill nodata cells on both rasters ...
  • 47.7k
1 vote
Accepted

QgsRasterCalculator not writing any output nor showing error codes

There are several suggestions regarding your code: work with os.path package and its methods: basename, exists, join, and normpath TIFF is a raster dataset containing one or more layers called bands....
  • 25.8k
0 votes

QgsRasterCalculator not writing any output nor showing error codes

I've found the solution, based on Taras' comment. The issue was indeed in not assigning the band number. I fixed it by removing exp and ras.ref, and replacing it with ras.ref = 'test@1' exp = "%s*...
0 votes

Terracing and data format issues when converting DEM from float32 to UInt16

I had similar issues and it disappeared when using only displacement and not displacement+bump (under material properties/settings/surface/displacement set to displacement only. It is related to ...
2 votes

Layer not visible under Raster Calculator but visible in the Tree Panel

OK, i ve found an answer myself. Just need to add an extra step to be visible in processing tools: QgsProject.instance().addMapLayer(mapLayer=out_layer,addToLegend=False)
  • 233
2 votes
Accepted

Raster Calculation with Rasters of Different Extent using Rasterio

I think creating a window from the bounds of the larger raster then using that window with boundless=True to read the smaller raster should work. Something like: window = rasterio.windows.from_bounds(*...
  • 55.6k
1 vote

Recalculate raster

It seems that it is indeed the 'nodata' value - the actual value is presumably dependent on the data type.
  • 103
2 votes

Using Raster Calculator without Clipping to Extent of Smallest Raster (QGIS)

The QGIS raster calculator is a front end to the gdal_calc Python utility https://gdal.org/programs/gdal_calc.html. The utility has an option for controlling the behavior with extent: --extent=<...
  • 55.3k
1 vote
Accepted

QGIS Python script with Raster Calculator

I think it's easier to use GDAL raster calculator. I execute the tool manually once in QGIS, press Ctrl+Alt+H and copy the command. Then write the loop. To create the output names you can use layer....
  • 56.9k

Top 50 recent answers are included