RasterReprojector

Reprojects a raster into another coordinate reference system, given by its code, as EPSG:32632 for WGS 84 / UTM zone 32N. The cells of the new grid are computed from the original ones with the chosen interpolation: nearest neighbour keeps the original values, as needed for maps of classes or codes, bilinear and bicubic smooth them, better for continuous values as the elevation. The cell size of the output can be set; if not, it is estimated from the original one.

Parameters

Reprojects a raster into another coordinate reference system, optionally with a new cell size.

Toolbox folder: Raster Processing
Status: Certified
Keywords: Raster, Reprojection, CRS
Authors: Andrea Antonello
Class: org.hortonmachine.modules.RasterReprojector

Inputs

Parameter

Type

Unit

Default

Description

inRaster

raster file

The raster to reproject.

pXres

Double

The optional cell size in x of the output.

pYres

Double

The optional cell size in y of the output.

pCode

CRS code

The code of the target coordinate reference system, as EPSG:32632.

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.

Outputs

Parameter

Type

Unit

Description

outRaster

output file

The reprojected 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.RasterReprojector

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

// from Monte Mario / Italy zone 1 to WGS 84 / UTM zone 32N
var reprojector = new RasterReprojector()
reprojector.inRaster = folder + "dtm_flanginec.tif"
reprojector.pCode = "EPSG:32632"
reprojector.outRaster = folder + "dtm_utm.tif"
reprojector.process()