Skip to main content
23 votes

Performing Raster Reclassification in QGIS

I was able to reclassify a raster using the raster calculator Here the "Habitat" raster is reclassed from continuous values (0-1) to discrete values of 1,2,3 ("Habitat@1" < 0.3)* 1 + (("Habitat@...
knussear's user avatar
  • 331
17 votes
Accepted

Reclassifying raster using GDAL?

gdal_calc can be used for a reclassification of many classes. For example, you can change values below (and equal) 12 to 10, values of 20, 30, 40, 50 stays the same, and values between above 50 and ...
Jot eN's user avatar
  • 972
17 votes

Reclassifying raster values in Google Earth Engine?

The accepted solution addresses the very specific case at hand, and while admirably clever (kudos for that), does not answer the question, which is "How to reclass ranges in GEE". A more ...
Djaner Emin's user avatar
12 votes

Performing Raster Reclassification in QGIS

QGIS now has two native raster reclassify algorithms Reclassify by layer - allows you to use a vector layer to dictate your ranges Reclassify by table - works much like ArcGIS raster reclassify ...
Phil Barlow's user avatar
11 votes

Raster reclassify using python, gdal and numpy

Here's a basic example using rasterio and numpy: import rasterio as rio import numpy as np with rio.open('~/rasterio/tests/data/rgb1.tif') as src: # Read the raster into a (rows, cols, depth) ...
Damon's user avatar
  • 111
10 votes
Accepted

Reclassifying raster values in Google Earth Engine?

ee.Image.remap() operates on individual values, not ranges of numbers like your example shows. Given that you are trying to convert the slope values to a set of bins with equal spacing, you can just ...
Tyler Erickson's user avatar
9 votes

Raster reclassify using python, gdal and numpy

Just to complete the answer from @Mattijn, I think that will lead into a problem if the input classes overlap with the output classes. I don't want my new value to be changed by the next rule. I don'...
etrimaille's user avatar
  • 7,290
9 votes
Accepted

Calculating statistics per area for categorical raster using R?

In R, you can extract the raster data for each polygon and then summarize it. First, lets create some data (FYI, you can read in a shapefile using raster::shapefile or rgdal::readOGR and a raster ...
Jeffrey Evans's user avatar
8 votes

Reclassifying raster using GDAL?

gdal_reclassify is an unofficial Python tool, based on Python GDAL bindings, able to reclassify according to several classes of values. Requirements: python numpy gdal binaries python-gdal bindings ...
Antonio Falciano's user avatar
8 votes
Accepted

Raster calculator reclass 0 as 0 QGIS

Simply write "raster_name@1" != 0 AND "raster_name@1" <= 15 in order to set all values between 1 and 15 to 1, and everything else to 0.
ArMoraer's user avatar
  • 5,659
8 votes

Save and load the classes definition table in the QGIS reclassify by table tool

This is a workaround using Reclassify by layer tool (so it is not a direct answer to your query). (1) Prepare a classification table by a spreadsheet software ( I used MS-Excel). (2) Drag and Drop ...
Kazuhito's user avatar
  • 31k
7 votes

Reclassify a raster file with quantiles

If it is just for visualisation, then you can adjust how the raster is displayed in QGIS, by choosing single band pseudo colour with discrete colour interpretation - you can then adjust the boundaries ...
user6072577's user avatar
  • 1,582
7 votes
Accepted

Reclassify a Vector Landuse file using QGIS

This is an example (please modify as necessary). "landuse" should be your actual field name of original class. CASE WHEN "landuse" = 1 THEN 5 WHEN "landuse" = 2 THEN 0 WHEN "landuse" = 3 THEN 10 ...
Kazuhito's user avatar
  • 31k
7 votes
Accepted

Reclassify rasters in R using terra package

Example data library(terra) r <- rast(ncol=18, nrow=9) values(r) <- sample(7, ncell(r), replace=TRUE) r[,5:8] <- NA rc1 <- rc2 <- rc3 <- r rc1[1:6,] <- NA rc2[3:9,] <- NA ...
Robert Hijmans's user avatar
6 votes
Accepted

Reclass to decimals

Multiply everything by orders of magnitude until you are working with integers rather than decimals. In other words, if your raster has values of 1-10, and you want to reclassify some of those values ...
Dan C's user avatar
  • 12.3k
6 votes
Accepted

Lapply function on raster iterating through SPDF polygons in R

You can try crop and mask instead of only masking over the Raster Layers. Try the reproducible and commented code below. In this example, using crop reduced ~ 92% the size of the objects in the R ...
Guz's user avatar
  • 3,176
6 votes
Accepted

PyQGIS GRASS r.reclass from Processing without result

There are some syntax errors. If you run this code from the Python Console: import processing processing.alghelp("grass7:r.reclass") you will get: ALGORITHM: r.reclass - Creates a new map layer ...
mgri's user avatar
  • 16.3k
6 votes
Accepted

Create presence/absence (0/1) rasters for every value in categorical raster in R?

The raster package has a function to do this for you in one line. Use layerize(): library(raster) # make an example raster r <- raster(nrow=100, ncol=100) r[] <- round(runif(ncell(r),1,4),0) # ...
Katie's user avatar
  • 350
6 votes
Accepted

Remap with number-limits and not individual values in GEE

I think what you need is something like this: var random = ee.Image.random() var customRemap = function(image, lowerLimit, upperLimit, newValue) { var mask = image.gte(lowerLimit).and(image.lt(...
Rodrigo E. Principe's user avatar
6 votes
Accepted

Reclassifying rasterstack in R?

Your reclassification matrix isn't right - I suspect the 0.990 on rows 3 and 4 should be 0.099 - as it is the rows make up overlapping classes so the function throws an error: > reclmat [,1]...
Spacedman's user avatar
  • 65.1k
6 votes

Arcpy reclassify with function

This is how I would do it (it requires the Spatial Analyst extension which I think you have): import arcpy from arcpy.sa import * arcpy.CheckOutExtension = "Spatial" ndvi_raster = Raster("...
umbe1987's user avatar
  • 3,785
5 votes
Accepted

Algorithm r.reclass in QGIS gives same results with different reclass rules

The problem, as you can see from the log, is that r.reclass rounds up your raster values to either 0 or 1, depending on the value. That is because r.reclass only works with integer input values. In ...
Miron's user avatar
  • 1,241
5 votes
Accepted

Reclassifying NDWI using Google Earth Engine?

What about values equal to 0.4? .gt(): greater than .gte(): greater or equal than Then: // Reclassify each image in NDWI collection and calculate yearly composite var reclassified = NDWI.map(...
Rodrigo E. Principe's user avatar
5 votes

Reclassify values of the land use land cover class of Copernicus Global Land Cover Layers in Google Earth Engine

The variable lulc1 is an image collection with 5 elements (images between years 2015 and 2019). If you want to reclassify it, it is preferable to map entire collection with a function. Following code ...
xunilk's user avatar
  • 30k
4 votes

Reclassify a raster file with quantiles

You can do in QGIS processing toolbox. Use the model builder and build a model with r.quantile followed by r.recode. Something like this:
lcoandrade's user avatar
4 votes

QGIS Natural Breaks with raster file

No it is not possible to classify the image using Natural break. In QGIS 2.18.9 Quantile was added in the classification which was not exist in QGIS 2.14.15, as you can see below: QGIS 2.18.9 has 3 ...
ahmadhanb's user avatar
  • 41.1k
4 votes
Accepted

Using arcpy to reclassify "NoData" to a value

You could use a conditional instead: reclassify = arcpy.sa.Con(arcpy.sa.IsNull(raster), 0, raster, "Value = 1") reclassify.save(export_path) This will evaluate a version of your raster where all ...
Gabriel's user avatar
  • 3,155
4 votes
Accepted

Reclassifying certain values using ArcPy in ArcGIS Pro?

You can use this approach Esri provide for ArcGIS Pro Reclassify Reclassifies (or changes) the values in a raster. I would suggest using the code samples they provide as guidance as to how you can ...
whyzar's user avatar
  • 12.1k
4 votes

Layer names changed after reclassification of rasterstack, R

Using the example in the help for reclassify (because we can't run your code because we don't have your new object)... If a raster has names: > names(r)="Region-A" and is reclassified.... > ...
Spacedman's user avatar
  • 65.1k
4 votes
Accepted

Partial raster reclassify in QGIS

You can use Raster Calculator with the following formula: (("RasterFile@1" > 0) AND ("RasterFile@1" < 50)) * "RasterFile@1" The above expression will produce a raster data with pixel values ...
ahmadhanb's user avatar
  • 41.1k

Only top scored, non community-wiki answers of a minimum length are eligible