RasterResolutionResampler

Resamples a raster to a new cell size, on the same extent and in the same coordinate reference system. Larger cells make the maps lighter and the computations faster, at the price of detail, as for a first analysis of a large area; smaller cells don’t add detail, they only split the existing one. As for the reprojection, nearest neighbour keeps the original values, bilinear and bicubic smooth them.

Parameters

Resamples a raster to a new cell size, on the same extent, with the chosen interpolation.

Toolbox folder: Raster Processing
Status: Experimental
Keywords: Raster, Resampling, Resolution
Authors: Andrea Antonello
Class: org.hortonmachine.modules.RasterResolutionResampler

Inputs

Parameter

Type

Unit

Default

Description

inGeodata

raster file

The raster to resample.

pInterpolation

String

nearest neightbour

The interpolation of the new cells: nearest neighbour keeps the original values, as needed for classes and codes; bilinear and bicubic smooth them. Allowed values: nearest neightbour, bilinear, bicubic.

pXres

Double

The new cell size in x.

pYres

Double

The new cell size in y; if not set, the one in x.

Outputs

Parameter

Type

Unit

Description

outGeodata

output file

The resampled 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.RasterResolutionResampler

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

// from 10 m to 50 m cells
var resampler = new RasterResolutionResampler()
resampler.inGeodata = folder + "dtm_flanginec.tif"
resampler.pXres = 50.0
resampler.pYres = 50.0
resampler.outGeodata = folder + "dtm_50m.tif"
resampler.process()
The elevation of the sample area resampled from 10 m to 50 m cells.

The elevation of the sample area resampled from 10 m to 50 m cells.