Vectorizer

Converts a raster into a vector of polygons, one for each area of cells with the same value, with the value in a field. It is the way to bring the results of the raster analyses, as basins, classes or hazard zones, into the vector world, to measure them, combine them with other vectors or edit them. A threshold on the number of cells discards the smallest polygons, and the holes can be removed. The no-data cells are not converted.

Parameters

Converts a raster into a vector of polygons, one for each area of cells with the same value. The no-data cells are not converted.

Toolbox folder: Vector Processing
Status: Certified
Keywords: Raster, Vector, Polygons, Conversion
Authors: Andrea Antonello
Class: org.hortonmachine.modules.Vectorizer

Inputs

Parameter

Type

Unit

Default

Description

inRaster

raster file

The raster to convert.

pValue

Double

The value of the cells to convert, the others become no-data; if not set, all the values are converted.

fDefault

String

value

The name of the field of the polygons with the value of their cells.

pThres

double

0

The number of cells under which the polygons are discarded.

doRegioncheck

boolean

false

First shrink the region to the cells with values, faster on sparse rasters.

Outputs

Parameter

Type

Unit

Description

outVector

output file

The vector of the polygons.

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.Vectorizer

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

// the polygon of the basin of Wateroutlet
var vectorizer = new Vectorizer()
vectorizer.inRaster = folder + "outlet_basin.tif"
vectorizer.outVector = folder + "outlet_basin.shp"
vectorizer.process()
The outline of the polygon of the basin of Wateroutlet.

The outline of the polygon of the basin of Wateroutlet.