RangeLookup¶
Reclassifies a raster by ranges of values: each cell gets the class of the range its value falls in. It turns continuous maps into classes, as elevation belts, slope classes for a hazard map or the bins of a legend, and the classes can then be combined with Mapcalc or converted into polygons with Vectorizer.
Details¶
The ranges are separated by commas, each with its lower and upper bound separated by a space and enclosed in brackets: a square bracket includes the bound, a round one excludes it, and null leaves the range open on that side. The classes, also separated by commas, go to the ranges in the same order. For example [0 10),[10 20),[20 null) with 1,2,3 gives 1 to the values from 0 to below 10, 2 from 10 to below 20 and 3 from 20 up. The cells that fall in no range become no-data, and the no-data cells of the input stay no-data, also in a range open downwards.
Parameters¶
Module for raster rangelookup.
Toolbox folder: Raster Processing
Status: Certified
Keywords: Raster, Rangelookup
Authors: Andrea Antonello
Class: org.hortonmachine.modules.RangeLookup
Inputs
Parameter |
Type |
Unit |
Default |
Description |
|---|---|---|---|---|
|
raster file |
The raster that has to be processed. |
||
|
String |
The ranges in the form [r1l r1h),[r2l r2h] |
||
|
String |
The classes to substitute in the same order of the ranges (in the form 1,2) |
Outputs
Parameter |
Type |
Unit |
Description |
|---|---|---|---|
|
output file |
The processed raster. |
Example¶
The example runs on the sample elevation model of the manual, dtm_flanginec.tif in docs/manual/modules/maps/data, each module on the outputs of the previous ones:
import org.hortonmachine.modules.RangeLookup
// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"
var rangeLookup = new RangeLookup()
rangeLookup.inRaster = folder + "pit.tif"
// three elevation belts: below 1300 m, from 1300 to 1700 m, above 1700 m
rangeLookup.pRanges = "[null 1300),[1300 1700),[1700 null)"
rangeLookup.pClasses = "1,2,3"
rangeLookup.outRaster = folder + "elevation_belts.tif"
rangeLookup.process()
The three elevation belts of the sample elevation model.¶