# Questions tagged [raster-calculator]

A tool in some GIS software programs for performing algebraic operations on rasters.

1,268 questions
Filter by
Sorted by
Tagged with
73k views

### Setting all pixels with value <= 0 to "nodata" in DEM raster using QGIS

I am using QGIS. I have a DEM raster with pixel values between about 3000 and -0.0003. I need to set all pixel with a value of 0 and smaler (<=0) to "nodata" (for later raster ...
• 8,338
76k views

### Cropping raster layer using QGIS?

How do I crop a raster layer in QGIS? I want to make contours from a section of a layer, and including the whole layer will create far more data than I need and slow down the rendering. I have ...
• 303
2k views

### Calculating Focal Statistics for Special Neighborhood?

I'm looking to calculate focal statistics for each cell of a raster, within a neighborhood of a specified criteria. Background - I have three binary rasters, each representing a single vegetation ...
• 1,284
7k views

### Working with NaN/null and different extents in QGIS Raster calculator?

When it comes to NULL value and different extents of rasters I find it extremely cumbersome to use QGIS raster calculator. As far as I am aware there is no way to operate with NaN/Null value. So no ...
• 9,784
33k views

### Writing Conditional Statements in QGIS raster calculator

What is the equivalent statement of the following expression in the QGIS raster calculator? Con(((Abs("DEM" - "FSMin") > 120) | (Abs("DEM" - "FSMax") > 120)), 1, 0) I have no problem ...
• 3,544
3k views

### Using variable in graphical modeler for raster calculation? (QGIS 3.8)

I am trying to create a flow in the graphical modeler using a variable in a raster calculation. Is there a way to use a variable directly in the raster calculator (SAGA or GDAL)? I know there was a ...
• 155
7k views

### How to calculate the number of cells with a given value?

I have a raster file where all cells have values between -3 and 7, no data value is -9999. How can I calculate the number of cells with a specific value, e.g. 6? Can I use the calculator?
• 111
25k views

### How to calculate the difference between two rasters in QGIS?

I have two similar rasters of the Mount Vesuvius and surroundings: one spans 20 kilometers, and the other one 50 kilometers. The two rasters are overlapping: What I would like to do is to create a ...
• 1,147
1k views

### Cube root on ArcGIS raster calculator?

How I could extract a cube root of the multiplication of 3 rasters in raster calculator? Eg: cuberoot (ras1 * ras2 * ras3)
1k views

### r.mapcalc does not give output in QGIS

For a while now I have been trying to use r.mapcalc from the QGIS Processing Toolbox. However, the algorithm does not give me any output. I have tried several raster layers and different expressions, ...
• 465
13k views

### Rounding pixel values of raster in QGIS

I have a raster with float number values for example: 2.544459104537964 and I want to round these up to integers. I have seen other posts on ArcGIS like this one but when I use Raster Calculator in ...
• 695
15k views

### Conditional calculation in QGIS Raster Calculator

Is it possible in QGIS either directly or via plugins to do a raster calculation including an if statement? e.g., if raster1 > 0.3, then raster 1 * raster 2, else raster1 x raster3... something ...
• 437
2k views

### Calculating distance from points to different class in raster using ArcGIS Spatial Analyst?

I am looking for some advice on how to calculate the distance from a point to a different class of a raster. Specifically, I have observations (points) of animal use overlaid on land cover data. ...
• 155
5k views

### Evaluating raster calculator expressions from console

How can I execute from the console an expression that should be used with the raster calculator? I'm searching for something like this: qgis.someRasterCalcClass.evaluate("boh@1 + boh@2", "outputfile....
• 623
9k views

### Specifying field in attribute table with raster calculator using ArcMap

How can I specify the attribute field to use in the raster calculator of ArcMap 10.2? In 9.x, I used the dot notation. i.e. To use the "New_Value" field, I could do the following: [MyRaster]....
• 1,445
943 views

### Rules of Nodata value?

What are the arithmetic rules that govern Nodata values? Regardless of how these null values are defined? I am using ArcMap Raster Calculator. I am thinking specifically of operations like 1*Nodata (...
• 3,544
6k views

### Using individual bands from multi-band image in ArcGIS raster calculator?

I'm trying to use individual bands from a multi-band TM image (IMG file) within the raster calculator in ArcGIS 10 (SP2/3). I can add individual bands to my MXD, but raster calculator will only use ...
• 331
17k views

### Normalize raster values to 0-255

I need to normalize the values attained from a band ratio to 0-255. I'm using QGIS. How do I do this? Any ideas?
• 5,588
3k views

### 30,000 data points... can this be reasonably served using openlayers?

I'm trying to tackle a web GIS problem and need to figure out the best strategy. I have a map with 30,000 cells on it forming a grid for the province of Alberta. I have a list of data points for ...
3k views

### How do I generate a random raster (or probabilistic cellular automaton) in QGIS?

I'm trying to create something like a cellular automaton land cover change model using QGIS, in which cells randomly change land cover based on probabilities determined from various input rasters. I'...
• 1,319
7k views

### Why does every raster calcuation I try return with NAN values?

I am trying to work with DEM rasters from the USGS using the raster calculator. I have tried to change the units from meters to feet using an expression such as: "ned10m45111h8@1" * 3.28 However ...
• 91
5k views

### Making new raster using con() script and ArcPy

I'm new to Python and have been trying to code a raster calculator style script. Basically, I want to convert a raster that has values 0 to -10,000 into a raster that is populated by 1s between ...
1k views

### Changing class of one pixel in classified image

I have a classified image (I did it in ERDAS) with six categories. There are some misclassified pixels (especially high-density urban category). Is there any way that I can choose one pixel and then ...
• 137
15k views

### How to standardize raster output from 0 to 100 using raster algebra?

I am working on generating an integrated moisture index based on the following equation: IMI = (hill shade * 0.5) + (curvature * 0.15) + (flow accumulation * 0.35) Iverson et al. 1997 Another ...
• 51.7k
7k views

### Rounding raster values in QGIS raster calculator?

Is it possible to round raster value in QGIS to a given number of digits? I have raster data with temperatures as values but the authors have made the values Celsius * 10. That is, a temperature of 2....
• 111
937 views

### Calculating urban areas that need pharmacies using QGIS?

I'm very new in QGIS. The task is to calculate the urban areas that has lack of pharmacies. I have buildings points with apartments count and existing pharmacies points. Then I made two raster ...
6k views

### How to exclude outliers from raster using ArcGIS for Desktop?

I calculated terrain curvature from a DEM. The DEM I use is interpolated from point elevation data. Generally, the DEM seems to be good, but some artifacts from interpolation exist. Those artifacts ...
• 203
266 views

### Raster calculator reclass 0 as 0 QGIS

I want to process a raster with values 0-16. I want to set all values between 1 and 15 as 1, a value of 16 as 0 and cells with a value of 0 as 0. How do I maintain a cell value of 0? I have tried ...
5k views

### Summing pixel values from several raster layers with partial overlap in QGIS?

I have several presence maps (rasters values 1 and 0) from different species. They are all from South America, but they do not have the same extend (i.e., different sizes). So, I am trying to ...
3k views

### Cell Statistics calculation in QGIS

Cell Statistics in ArcGIS will calculate the mean (or statistic of choice) among multiple rasters on a cell-by-call basis. Can QGIS do this and, if so, how?
• 99
9k views

### Changing raster cell values within polygon using QGIS GUI

How do I change the values of raster cells which are within a polygon, leaving all cell values outside the polygon unchanged? I would like to subtract 1.5m from each raster cell value within the ...
• 448
3k views

### gdal_calc - How to calculate where raster A is not equal to raster B?

I have two binary rasters with values NaN and 254. I want to generate a new raster that consists of the pixels that have value NaN in raster A and 254 in raster B and vice versa - those should be 1, ...
• 241
8k views

### SAGA tools in QGIS only allow save as .sdat file?

I'm just beginning to learn how to use SAGA 2.1.2 tools within QGIS 2.12.1 on a Windows 7 64 bit computer by working through exercises in Mastering QGIS by Menke et al. (https://www.packtpub.com/...
• 171
4k views

### Change NODATA pixel value in raster to arbitrary value

I want to change the value in all pixels that are currently 0 to 800 in QGIS 2.6.1. 0 is listed as the no-data value in Properties > Transparency. I have unchecked the No Data Value box there. Then I ...
• 71
839 views

### Calculate Volume over sloped ground in GRASS GIS

I am trying to do some volume calculations on a DEM with GRASS GIS. However, I believe r.volume measures everything from 0. The ground underneath the pile I'm measuring is sloped. I would ...
• 3,412
2k views

### How to calculate a standard deviation across multiple raster layers?

I have 15 raster layers. Each one shows accumulated precipitation (rainfalls) for the month of April for the same US state during a given year. So, I cover the period from 1997 to 2012. I would like ...
• 983
916 views

### Multiple conditional statements for raster calculation in R

In the context of a RUSLE erosion modelling I would like to calculate the sum of precipitation at the entry date of phenological phases. Suppose I have 13 grids, one of which is the phenophase entry ...
6k views

### how to get max and min from a raster using arcpy?

I have a land surface temperature raster file and I want the max and min of it. minLSTresult = arcpy.GetRasterProperties_management(raster_result, "MINIMUM") minLST = minLSTresult.getOutput(0) ...
• 125
23k views

### Normalizing raster using raster calculator in ArcGIS 10.3.1? [duplicate]

I have been trying to 'range standardise' or normalise my raster values from 0-100 and I know how to do this mathematically: ("raster"-min("raster"))/(max("raster")-min("raster"))*100 and I have ...
• 531
15k views

### Removing pixel values below 0 in Digital Elevation Model in ArcGIS for Desktop?

I made a DEM layer from a .las file (LiDAR). How can I remove the black area which contains negative values? Is it possible to set these values equal zero or null?
• 201
3k views

### Raster Calculator making incorrect calculations in ArcGIS Desktop?

I am trying to use raster calculator (ArcMap 10.2.2.3552) to apply a poisson generalized linear model to estimate species abundances based on elevation. The outputs don't make any sense to me, and I'm ...
• 63
2k views

### Performing Raster Calculator functions using Python and open source modules?

I would like to perform mathematical functions similar to those you would use Raster Calculator for in ArcMap, however I'd like to do it in Python without using the ArcpPy module. I have the osgeo ...
• 177
2k views

### QGIS calculate sum of values in more raster layers

I have cloud masks (rasters) of diferrent days (from sentinel 2a product) and I would like to calculate how many times was some area covered by clouds. My basic idea is put all layers on each other ...
• 391
1k views

### How to update raster pixel values based on another raster with conditions in QGIS?

I have 2 land cover rasters. I want to update parts of the first raster with values from the second using QGIS. The workflow should be like this: 1. Select values equal to 30 and 34 in the first ...
• 475
731 views

### Adding all Binary Rasters in a Directory Using Raster Calculator in a Standalone Python Script

I have a directory with binary raster files (1 band only) which I need to add in a standalone python script. The problem is the rasters have different number of rows and columns and different ...
• 507
17k views

### Convert 0's to NoData in QGIS Raster Calculator [duplicate]

What is the easiest way to convert cells with a value of 0 to NoData in QGIS Raster Calculator?
• 1,304
749 views

### Automating creation of toe of slope from DEM using ArcMap

I was looking for an automated process to "identify" the toe of a slope from a DEM and ran across this Esri thread and technique: I am at Step 7 but have no idea how this is accomplished. I ...
3k views

### Adding two raster datasets that overlap while maintaining extent of larger raster dataset?

I am using ArcMAP 10.0 How do I add two raster datasets that overlap while maintaining the extent of the larger raster dataset. I have thought of adding zero values to the smaller raster to then be ...
• 113
16k views

### How to use OR in a CON statement, in the ArcGIS Raster Calculator?

I'm trying to compare two rasters, and create an output based on a formula like: if raster1 > 10 or raster2 < 20 then raster3 = 30 How can I specify the OR in the raster calculator's CON ...
• 21.2k