Compute statistics of the features in a set of OGR Layers


Compute statistics (mean and standard deviation) of the features in a set of OGR Layers, and write them in an XML file. The resulting XML file can then be used by the training application.

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.


Vector Data -inshp vectorfile Mandatory
Name of the input shapefile

Output XML file -outstats filename [dtype] Mandatory
XML file containing mean and variance of each feature.

Feature -feat string1 string2...
List of features to consider for statistics.


From the command-line:

otbcli_ComputeOGRLayersFeaturesStatistics -inshp vectorData.shp -outstats results.xml -feat perimeter

From Python:

import otbApplication

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

app.SetParameterString("inshp", "vectorData.shp")
app.SetParameterString("outstats", "results.xml")
app.SetParameterStringList("feat", "perimeter")



Experimental. For now only shapefiles are supported.

See also