4.2.5 Vector data set field

Set a field in vector data.

Detailed description

Set a specified field to a specified value on all features of a vector data.

Parameters

This section describes in details the parameters available for this application. Table 4.36, page 486 presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is VectorDataSetField.





Parameter key

Parameter type

Parameter description




in

Input vector data

Input

out

Output vector data

Output

fn

String

Field

fv

String

Value

inxml

XML input parameters file

Load otb application from xml file

outxml

XML output parameters file

Save otb application to xml file











Table 4.36: Parameters table for Vector data set field.

Example

To run this example in command-line, use the following:

otbcli_VectorDataSetField -in qb_RoadExtract_classification.shp -out VectorDataSetField.shp -fn Info -fv Sample polygon

To run this example from Python, use the following code snippet:

#!/usr/bin/python 
 
# Import the otb applications package 
import otbApplication 
 
# The following line creates an instance of the VectorDataSetField application 
VectorDataSetField = otbApplication.Registry.CreateApplication("VectorDataSetField") 
 
# The following lines set all the application parameters: 
VectorDataSetField.SetParameterString("in", "qb_RoadExtract_classification.shp") 
 
VectorDataSetField.SetParameterString("out", "VectorDataSetField.shp") 
 
VectorDataSetField.SetParameterString("fn", "Info") 
 
VectorDataSetField.SetParameterString("fv", "Sample polygon") 
 
# The following line execute the application 
VectorDataSetField.ExecuteAndWriteOutput()

Limitations

Doesn’t work with KML files yet

Authors

This application has been written by OTB-Team.