Loading [MathJax]/extensions/tex2jax.js
Python script preCutting
See also
python.workflows.preCutting

Aim of module

Cuts an ODM/Raster file using one or more polygons of a shape file.

General description

In order to process them correctly, the polygons within the shapefile have to be non self-intersecting and must not have holes.

ATTENTION! In case of RASTER data, please make sure to handle the resampling and the rounding right. In case that the values should stay constant in resampling (e.g. Classification, Integer-values), nearestNeighbour resampling has to be used. For other applications (Height models etc.), bilinear and bicubic resampling modes are more suitable. Some raster properties and the resampling mode can lead to half-pixel offsets in the results! To avoid them, the rounding mode (-c) can be switched between center and corner.

See also
Script documentation

Parameter description

-buffer Buffering distance around the polygon in meters.
Type : Floating-point number
Remark : optional, default: 0
Exporting Options
Settings concerning type and location of the resulting files.
-export [path]\[prefix of filename].[extension]
Type : Path
Remark : optional
Description: Define the [path]\[prefix of filename].[extension] - any of the three may be left out. For example: -export U:\results\polygons\cut\myPrefix.jpg
-oformat GDAL driver for raster, file format or XML file for Vector.
Type : String
Remark : optional
-skipIfExists Skip processing if result already exists.
Type : Boolean
Remark : optional, default: True
possible inputevaluates to
1, true, yes, Boolean(True), TrueBoolean(True)
0, false, no, Boolean(False), FalseBoolean(False)
-writeEmptyTiles if True also empty tile files are created
Type : Boolean
Remark : optional, default: False
possible inputevaluates to
1, true, yes, Boolean(True), TrueBoolean(True)
0, false, no, Boolean(False), FalseBoolean(False)
-odmTileSize Optional odm tiles size when exporting odm files. If not set, the automatic odm tile size estimation is used
Type : Floating-point number
Remark : optional
-singleFilePerTile One input file per output tile
Type : Boolean
Remark : optional, default: False
Description: If set to True only one input file is used for creating the output tile (based on the shortest distance between center points of the input files)
possible inputevaluates to
1, true, yes, Boolean(True), TrueBoolean(True)
0, false, no, Boolean(False), FalseBoolean(False)
-distribute determine how many local processes should be used
Type : Integer
Remark : optional, default: 1
Description: Sets the number of processes that work in a aprallel way to cut the tiles. (parts of) the program and therefore enhance the runtime.
-generateOverviews if True, overview matrices for a stricter overlap test are generated.
Type : Boolean
Remark : optional, default: True
Description: Controls, whether or not opalsInfo creates the overview matrices for inputshape Files. If they are already created by the user beforehand, the script will still check for strict overlaps.
possible inputevaluates to
1, true, yes, Boolean(True), TrueBoolean(True)
0, false, no, Boolean(False), FalseBoolean(False)
Input data Options
Settings concerning type an location of the input data.
-vector Path(s) to the vector file(s)
Type : Path
Remark : optional
Description: Path where the vector files to cut are located [mandatory if no rasterpath is specified]. At the moment only ODM files are supported. For example -vector U:\Tiles\*.tif -vector U:\OtherTiles\ -vector U:\Folder\poly*.tif
-raster Path(s) to the raster file(s)
Type : Path
Remark : optional
Description: Path where the raster files to cut are located [mandatory if no vectorpath is specified]. For example -raster U:\Tiles\*.tif -raster U:\OtherTiles\ -raster U:\Folder\poly*.tif
Raster cutting Options
Settings concerning the processing of raster data.
-truePolygons Use true polygon or rectangular bounding box
Type : Boolean
Remark : optional, default: False
Description: By default, only the polygon bounding box of rasters is cut out. With this option, it is possible to cut out the true polygon shape. Since the process is more time consuming, it should only be chosen for non-rectangular polygons.
possible inputevaluates to
1, true, yes, Boolean(True), TrueBoolean(True)
0, false, no, Boolean(False), FalseBoolean(False)
-formula Formula for the combination of overlapping raster files in opalsAlgebra.
Type : String
Remark : optional, default: mean(r)
-resamplingMethod OpalsGrid resampling method [bilinear | bicubic | nearestNeighbour]
Type : String
Remark : optional, default: bilinear
-roundingMethod Method to round the results to exakt pixel positions [corner | center]
Type : String
Remark : optional, default: corner
Polygon Shape file Options
Settings concerning the polygons to cut out.
-shapefile Shape file containing the polygons used as cutting limits.
Type : Path
Remark : mandatory
-attribute Name of the Shape file attribute that will be part of the export filename.
Type : String
Remark : optional, default: id
-pickpoly Choice of the target polygon(s) if not all polygon(s) shall be cut.
Type : String
Remark : optional
Logging Options
Settings concerning the verbosity level of logging.
-fileLogLevel Log level in the logfile
Type : LogLevel
Remark : optional, default: info
-screenLogLevel Log level on screen
Type : LogLevel
Remark : optional, default: info
-logger Logger
Type : Logger
Remark : optional
Description: Logger is usually provided by the opals framework.The user may provide their own logger object, but it has to function in the same way as the opals Logger.

Examples

As a prerequisite for the subsequent examples, please import the data using the following commands:

opalsImport -inf G111.las
opalsImport -inf G112.las
opalsImport -inf G113.las

Example 1

This example uses preTiling to create a shapefile with tiles and then cuts the odm according to the tiles.

preTiling -vector G111.odm -tilesize 300 -skip False
preCutting -vector G111.odm -shapefile Tiles.shp -export G111_tile -skip False

Example 2

This example loads the three input files using a wildcard and then again first creates a tiling and cuts according to it.

preTiling -vector G11*.odm -tilesize 300 -skip False
preCutting -vector G11*.odm -shapefile Tiles.shp -export tile -skip False

Example 3

preCutting also supports las-files as input.

preTiling -vector G111.las -tilesize 300 -skip False
preCutting -vector G111.las -shapefile Tiles.shp -export G111_tile -skip False -buffer 10

Example 4

preCutting also supports a mix of odm and las-files as input.

preTiling -vector G111.las G112.odm -tilesize 300 -skip False
preCutting -vector G111.las G112.odm -shapefile Tiles.shp -export tile -skip False -buffer 10
@ tile
flat tiling structure
opalsImport is the executable file of Module Import
Definition: ModuleExecutables.hpp:113
@ vector
General vector data file (las, shp, ..)