RasterResizer

Cuts a raster to a smaller area, without resampling it: the cells keep their size and position.

Parameters

Cuts a raster to the bounds of a polygon vector or of a mask raster, keeping its resolution. The new bounds are snapped to the cells of the original raster.

Toolbox folder: Raster Processing
Status: Experimental
Keywords: Raster, Vector, Resize
Authors: Andrea Antonello
Class: org.hortonmachine.modules.RasterResizer

Inputs

Parameter

Type

Unit

Default

Description

inVector

vector file

The optional polygon vector to use for the bounds.

inMaskRaster

raster file

The optional raster to use as mask.

inRaster

raster file

The raster to resize.

Outputs

Parameter

Type

Unit

Description

outRaster

output file

The resized 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.RasterResizer

// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"

// cut the elevation to the extent of the basin
var resizer = new RasterResizer()
resizer.inRaster = folder + "dtm_flanginec.tif"
resizer.inVector = folder + "basin.shp"
resizer.outRaster = folder + "dtm_basin.tif"
resizer.process()
The elevation of the sample area, cut to the extent of the basin of ExtractBasin.

The elevation of the sample area, cut to the extent of the basin of ExtractBasin.