栅格化

重新投影和栅格化矢量数据集

描述

重新投影和栅格化矢量数据集。栅格化输出的网格可以通过使用参考图像或通过手动设置所有参数(原点、大小、间距)来设置。在后一种情况下,至少需要间距(地面采样距离)(其他参数自动计算)。栅格化的输出也可以位于与输入数据集不同的投影参考系中。

该应用程序中有两种可用的栅格化模式。第一种是二进制模式:它允许以前景色呈现属于输入数据集的几何图形的所有像素,同时以背景色呈现另一个像素。第二种方法允许根据几何体的属性来呈现属于该几何体的像素。要呈现的属性的字段可以由用户设置。在第二种模式中,背景值仍用于未关联的像素。

参数

Input vector dataset -in vectorfile Mandatory
The input vector dataset to be rasterized

Output image -out image [dtype] Mandatory
An output image containing the rasterized vector dataset

Input reference image -im image
A reference image from which to import output grid and projection reference system information.

Output size x -szx int
Output size along x axis (useless if support image is given)

Output size y -szy int
Output size along y axis (useless if support image is given)

Output EPSG code -epsg int
EPSG code for the output projection reference system (EPSG 4326 for WGS84, 32631 for UTM31N...,useless if support image is given)

Output Upper-left x -orx float
Output upper-left corner x coordinate (useless if support image is given)

Output Upper-left y -ory float
Output upper-left corner y coordinate (useless if support image is given)

Spacing (GSD) x -spx float
Spacing (ground sampling distance) along x axis (useless if support image is given)

Spacing (GSD) y -spy float
Spacing (ground sampling distance) along y axis (useless if support image is given)

Background value -background float Default value: 0
Default value for pixels not belonging to any geometry

Rasterization mode -mode [binary|attribute] Default value: binary
Choice of rasterization modes

  • Binary mode
    In this mode, pixels within a geometry will hold the user-defined foreground value
  • Attribute burning mode
    In this mode, pixels within a geometry will hold the value of a user-defined field extracted from this geometry.

二进制模式选项

Foreground value -mode.binary.foreground float Default value: 255
Value for pixels inside a geometry

属性刻录模式选项

The attribute field to burn -mode.attribute.field string Default value: DN
Name of the attribute field to burn


Available RAM (MB) -ram int Default value: 256
Available memory for processing (in MB).

实例

从命令行执行以下操作:

otbcli_Rasterization -in qb_RoadExtract_classification.shp -out rasterImage.tif -spx 1. -spy 1.

来自Python的评论:

import otbApplication

app = otbApplication.Registry.CreateApplication("Rasterization")

app.SetParameterString("in", "qb_RoadExtract_classification.shp")
app.SetParameterString("out", "rasterImage.tif")
app.SetParameterFloat("spx", 1.)
app.SetParameterFloat("spy", 1.)

app.ExecuteAndWriteOutput()

另请参阅

目前,对具有不同投影参考系的多个层的输入数据集的支持有限。