# Rasterization

## Brief Description

Rasterize a vector dataset.

## Tags

Vector Data Manipulation

## Long Description

This application allows reprojecting and rasterizing a vector dataset. The grid of the rasterized output can be set by using a reference image, or by setting all parmeters (origin, size, spacing) by hand. In the latter case, at least the spacing (ground sampling distance) is needed (other parameters are computed automatically). The rasterized output can also be in a different projection reference system than the input dataset. There are two rasterize mode available in the application. The first is the binary mode: it allows rendering all pixels belonging to a geometry of the input dataset in the foreground color, while rendering the other in background color. The second one allows rendering pixels belonging to a geometry woth respect to an attribute of this geometry. The field of the attribute to render can be set by the user. In the second mode, the background value is still used for unassociated pixels.

## Parameters

- [param] -in <string> The input vector dataset to be rasterized. Mandatory: True. Default Value: ""
- [param] -out <string> An output image containing the rasterized vector dataset. Mandatory: True. Default Value: ""
- [param] -im <string> A reference image from which to import output grid and projection reference system information.. Mandatory: False. Default Value: ""
- [param] -szx <int32> Output size along x axis (useless if support image is given). Mandatory: False. Default Value: "0"
- [param] -szy <int32> Output size along y axis (useless if support image is given). Mandatory: False. Default Value: "0"
- [param] -epsg <int32> EPSG code for the output projection reference system (EPSG 4326 for WGS84, 32631 for UTM31N...,useless if support image is given). Mandatory: False. Default Value: "0"
- [param] -orx <float> Output upper-left x coordinate (useless if support image is given). Mandatory: False. Default Value: "0.0"
- [param] -ory <float> Output upper-left y coordinate (useless if support image is given). Mandatory: False. Default Value: "0.0"
- [param] -spx <float> Spacing (ground sampling distance) along x axis (useless if support image is given). Mandatory: False. Default Value: "0.0"
- [param] -spy <float> Spacing (ground sampling distance) along y axis (useless if support image is given). Mandatory: False. Default Value: "0.0"
- [param] -background <float> Default value for pixels not belonging to any geometry. Mandatory: True. Default Value: "0"
- [param] -ram <int32> Available memory for processing (in MB). Mandatory: False. Default Value: "128"
[choice] -mode Choice of rasterization modes binary,attribute. Mandatory: True. Default Value: "binary"

- [group] -binary

- [param] -mode.binary.foreground <float> Value for pixels inside a geometry. Mandatory: True. Default Value: "255"

- [group] -attribute

- [param] -mode.attribute.field <string> Name of the attribute field to burn. Mandatory: True. Default Value: "DN"

## Limitations

None

## Authors

OTB-Team

## See Also

For now, support of input dataset with multiple layers having different projection reference system is limited.

## Example of use

- in: qb_RoadExtract_classification.shp

- out: rasterImage.tif

- spx: 1.

- spy: 1.