Module Contouring
See also
opals::IContouring

Aim of module

Derives the contour of foreground objects of a raster model and exports the results as a polygon shape file.

General description

The input raster grid cell values are rounded to integer values. After rounding, zero values are regarded as background, non-zero pixels are regarded as foreground regions. This also implies, that nodata value is not considered, so if areas with no data should not be contoured, then its pixel value should be set to zero. Contiguous foreground pixels are contoured as one polygon. The result of the contouring is the outline of foreground pixels. This outline consists of pixel edge segments instead of segments connecting pixel centers. The holes (background pixels in the foreground object) are handled as inner rings (see OGR definition). Single pixels are not outlined (neither foreground pixels as objects, neither background pixels as holes). Polygons with area less than minArea are not written in the SHAPE file.

Parameter description

-inFileinput raster files
Type: opals::Path
Remarks: mandatory
The specified input file (in GDAL supported format) is analyzed, all foreground pixels (pixel value != 0) are contoured and the contours are labelled.
-outFileoutput contours file
Type: opals::Path
Remarks: estimable
Path to output file containing contour polygons. The polygons are exported in ESRI Shape format.
Estimation rule: The current directory and the name (body) of the input file are used as file name basis. Additionally, the postfix '_contour' and the extension corresponding to the output format are appended.
-contoursgeneric contours output object
Type: opals::Vector<opals::String>
Remarks: default=
The resulting polygons of a contouring calculation are provided as a vector of Well-Known-Text (WKT) strings. Specify -outParamFile to store the WKT strings to a parameter XML file.
-minAreaminimum area of polygons
Type: double
Remarks: default=0
If specified, only polygons with an area greater than minArea are exported. If omitted, no minimum area is considered
-compressCollinearcompress series of collinear vertices
Type: bool
Remarks: default=1
In series of collinear vertices, export only the start and end points, thereby resulting in a reduction of the amount of exported vertices, while not losing any information.

Examples


The data used in the following example can be found in the $OPALS_ROOT/demo/ directory. For strip 21 (contained in the demo directory) the following commands are required to obtain DSM model:

opalsImport -inf strip21.laz
opalsGrid -inf strip21.odm -inter movingPlanes

As a result, a grid file strip21_z.tif in GeoTiff format is created. To obtain a binary grid of potential building areas we apply a simple thresholding to get cont_building.tif serving as input for the subsequent example.

opalsAlgebra -infile strip21_z.tif -outfile cont_building.tif -formula "r[0]>275. ? 1 : 0"

To elimanate single erroneous pixels (salt/pepper noise) we apply morphological operations on the cont_building.tif grid:

opalsMorph -inFile cont_building.tif -outFile cont_building_close_square_1.tif -operation CLOSE -kernelShape SQUARE -kernelSize 1
opalsMorph -inFile cont_building_close_square_1.tif -outFile cont_building_close_open_square_1.tif -operation OPEN -kernelShape SQUARE -kernelSize 1

Example 1: Building contours

In this example the contouring operation is applied on cont_building_close_open_square_1.tif dataset. This dataset is a GeoTiff grid:

cont_building_close_open_square_1.tif

For the contouring operation a minArea 100 parameter is applied.

opalsContouring -infile cont_building_close_open_square_1.tif -outfile cont_building_cos1.shp -minarea 100
The result ( cont_building_cos1.shp ) contains only polygons with greater than 100 unit^2 area.

Restrictions

The following restrictions apply:

  • The whole input raster must fit into the memory (RAM).
  • Only ESRI Shape is supported as output format.

References

Hollaus, M., W. Wagner, G. Molnar, G. Mandlburger, C. Nothegger, J. Otepka (2010) Deliniation of vegetation and building polygons from full-waveform airborne lidar data using OPALS software, Geospatial Data and Geovisualization: Environment, Security, and Society, Special Joint Symposium of ISPRS Technical Commission IV and AutoCarto 2010 in conjunction with ASPRS/GaGIS Speciality Conference, 15999 November 2010, Orlando, Florida, USA, CDROM, 7 p.

@ movingPlanes
moving (tilted) plane interpolation
opalsMorph is the executable file of Module Morph
Definition: ModuleExecutables.hpp:143
opalsAlgebra is the executable file of Module Algebra
Definition: ModuleExecutables.hpp:13
opalsImport is the executable file of Module Import
Definition: ModuleExecutables.hpp:113
@ kernelSize
output grid size equals entire kernel size
opalsGrid is the executable file of Module Grid
Definition: ModuleExecutables.hpp:93
opalsContouring is the executable file of Module Contouring
Definition: ModuleExecutables.hpp:28
@ formula
formula string for albegraic grid computations (opalsAlgebra)
@ operation
coordinate operation for crs transformations (opalsTranslate)