VectorDataTransform

Apply a transform to each vertex of the input VectorData

Description

This application iterates over each vertex in the input vector data file and performs a transformation on this vertex.

It is the equivalent of [1] that transforms images. For instance, if you extract the envelope of an image with [2], and you transform this image with [1], you may want to use this application to operate the same transform on the envelope.

The applied transformation is a 2D similarity. It manages translation, rotation, scaling, and can be centered or not. Note that the support image is used to define the reference coordinate system in which the transform is applied. For instance the input vector data can have WGS84 coordinates, the support image is in UTM, so a translation of 1 pixel along X corresponds to the X pixel size of the input image along the X axis of the UTM coordinates frame. This image can also be in sensor geometry.

This application has several output images and supports “multi-writing”. Instead of computing and writing each image independently, the streamed image blocks are written in a synchronous way for each output. The output images will be computed strip by strip, using the available RAM to compute the strip size, and a user defined streaming mode can be specified using the streaming extended filenames (type, mode and value). Note that multi-writing can be disabled using the multi-write extended filename option: &multiwrite=false, in this case the output images will be written one by one. Note that multi-writing is not supported for MPI writers.

Parameters

Input Vector data -vd vectorfile Mandatory
Input vector data file to transform

Output Vector data -out vectorfile Mandatory
Output vector data with

Support image -in image Mandatory
Image defining the reference coordinate system in which the transform is applied. Both projected and sensor images are supported.

Transform parameters

Group of parameters to define the transform

X Translation -transform.tx float Default value: 0
Translation in the X direction (in pixels)

Y Translation -transform.ty float Default value: 0
Translation in the Y direction (in pixels)

Rotation Angle -transform.ro float Default value: 0
Angle of the rotation (in degrees)

Center X -transform.centerx float Default value: 0
X coordinate of the rotation and scaling center (in physical units)

Center Y -transform.centery float Default value: 0
Y coordinate of the rotation and scaling center (in physical units)

Scale -transform.scale float Default value: 1
The scale coefficient to apply

Examples

From the command-line:

otbcli_VectorDataTransform -vd qb_RoadExtract_easyClassification.shp -in qb_RoadExtract.tif -out VectorDataTransform.shp -transform.ro 5

From Python:

import otbApplication

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

app.SetParameterString("vd", "qb_RoadExtract_easyClassification.shp")
app.SetParameterString("in", "qb_RoadExtract.tif")
app.SetParameterString("out", "VectorDataTransform.shp")
app.SetParameterFloat("transform.ro", 5)

app.ExecuteAndWriteOutput()