PointsRasterizer

Converts points into a raster: the cell that contains each point gets its value, a constant or the one of a numeric field, the others are novalue. It places measures, as the rain gauges or the survey points of a field campaign, on the grid of a model, and gives the presences that KernelDensity turns into a density.

The grid is given by its bounds, cell size and reference system, or it is taken from a raster, which must have the coordinate reference system of the points. To interpolate the values of the points on all the cells, use SurfaceInterpolator.

Details

Each point gives its value to the cell that contains it; the points on the border of two cells go to the one east or south of it, the ones on the east or south border of the grid to its last column or row, and the ones outside of the grid are left out. When more points fall in the same cell, the cell keeps the largest value. The rasterized points, as 1 where there is a point, give their density through KernelDensity; to interpolate the values of the points on all the cells, SurfaceInterpolator is the tool.

The value of the cells is the one of the numeric field of the point, or the constant category without a field. The grid is the one of the optional raster, or the one of the bounds, resolution and reference system.

Parameters

Converts points to a raster: the cell of each point gets its value, the others are novalue.

Toolbox folder: Raster Processing
Status: Certified
Keywords: Raster, Vector, Points, Rasterize
Authors: Andrea Antonello
Class: org.hortonmachine.modules.PointsRasterizer

Inputs

Parameter

Type

Unit

Default

Description

inVector

vector file

The points to rasterize.

fCat

String

The optional numeric field of the points with the value of their cells.

pCat

double

1.0

The value of the cells if no field is given.

inRaster

raster file

An optional raster that gives the grid, instead of bounds, resolution and reference system.

pNorth

Double

The boundary north coordinate.

pSouth

Double

The boundary south coordinate.

pWest

Double

The boundary west coordinate.

pEast

Double

The boundary east coordinate.

pXres

Double

The resolution in x.

pYres

Double

The resolution in y.

pCode

CRS code

The code defining the coordinate reference system, composed by authority and code number (ex. EPSG:4328).

Outputs

Parameter

Type

Unit

Description

outRaster

output file

The rasterized points.

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. It places the centroids of the subbasins of the DelaunayTriangulation example, with their mean elevation, on the cells of 100 m of RasterSubsampler:

import org.hortonmachine.modules.PointsRasterizer

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

// the centroids of the subbasins, with their mean elevation, on the 100 m grid of RasterSubsampler
var rasterizer = new PointsRasterizer()
rasterizer.inVector = folder + "subbasins_centroids.shp"
rasterizer.fCat = "avgelev"
rasterizer.inRaster = folder + "belts_100m.tif"
rasterizer.outRaster = folder + "centroids_avgelev.tif"
rasterizer.process()
The cells of 100 m that contain the centroids of the subbasins, colored by their mean elevation.

The cells of 100 m that contain the centroids of the subbasins, with the mean elevation of each subbasin.