RasterExtruder

Puts the values of a numeric field of polygons into a raster. The cells inside each polygon either get the value of the polygon, replacing theirs, or, with the add option, get it added to theirs. The cells outside the polygons are not changed.

Adding is the extrusion of the name: with the heights of the buildings, an elevation model of the terrain becomes one of the surface, with the buildings standing on it, for the analyses of visibility, shadows or flooding in urban areas. Replacing sets the cells to a given value, as the level of a lake.

Unlike BobTheBuilder, which interpolates the elevations of the artifact from points, the extruded polygon follows the shape of the terrain under it, raised by the same height everywhere.

Details

The polygons are rasterized on the grid of the raster with ScanLineRasterizer: the cells whose center is inside a polygon are changed, the others are kept. The field must be numeric, and the polygons in the CRS of the raster.

By default the value of the field replaces the one of the cell, as to set the elevation of a lake or of a flat area. With the add option, it is added to it: with the heights of the buildings, an elevation model of the terrain becomes one of the surface with the buildings extruded, for the analyses of visibility, shadows or flooding in urban areas. The novalues of the raster stay novalue.

Parameters

Puts the values of a field of polygons into a raster: the cells inside the polygons get the value of their polygon, or, with the add option, the value is added to the one of the cell, as the heights of the buildings onto an elevation model.

Toolbox folder: Raster Processing
Status: Draft
Keywords: vector, raster, add, extrude, buildings
Authors: Andrea Antonello, Silvia Franceschi
Class: org.hortonmachine.modules.RasterExtruder

Inputs

Parameter

Type

Unit

Default

Description

inRaster

raster file

The raster to modify, as an elevation model.

inVector

vector file

The polygons with the values.

pAddingField

String

The numeric field of the polygons with their value.

doAdd

boolean

false

If true, the value of the polygon is added to the one of the cell, else it replaces it.

Outputs

Parameter

Type

Unit

Description

outRaster

output file

The modified raster.

Example

The example raises the polygon of the dam of BobTheBuilder, dam.geojson in docs/manual/modules/maps/data, by its field height, 20 m, over the sample elevation model of the manual:

import org.hortonmachine.modules.RasterExtruder

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

// the polygon of the dam of BobTheBuilder, raised by its field height, 20 m,
// over the terrain: a wall that follows the ground, not a flat crest
var extruder = new RasterExtruder()
extruder.inRaster = folder + "dtm_flanginec.tif"
extruder.inVector = folder + "dam.geojson"
extruder.pAddingField = "height"
extruder.doAdd = true
extruder.outRaster = folder + "dtm_wall.tif"
extruder.process()
The difference between the extruded and the original elevation model: the polygon of the dam is 20 m higher everywhere, also on the slopes, where BobTheBuilder left the terrain unchanged.

The difference between the extruded and the original elevation model: the polygon of the dam is 20 m higher everywhere, also on the slopes, where BobTheBuilder left the terrain unchanged.