Python script opalsGeomorph
See also
python.workflows.opalsGeomorph

Aim of module

Package script providing tools for deriving geomorphic structure lines.

General description

See also
Script documentation

The Python script opalsGeomorph is the main script for the corresponding opalsGeomorph package. It uses sub-scripts ...

  • to derive 3d structure lines for a single 3d point cloud (Python script gmpLineModeler) and
  • to merge independently derived line datasets stemming from parallel processing of overlapping data tiles into a single comprehensive 3d line network (Python script gmpLineMerge).

The following table contains a list of all involved sub-scripts and their default storage location:

opalsGeomorph
OPALS Module Default Directory Comments
Module Import .\import ODM files
Module Grid .\grid strip-wise digital terrain and slope models
Module EdgeDetect .\lines2d edge candidates raster
Module Vectorize .\lines2d vectorized edges
Module LineTopology .\lines2d cleaned 2d structure line approximations
Module LineModeler \opalsGeomorph

3d structure lines iles

Parameter description

-distribute determine how many local processes should be used
Type : String
Remark : optional
Description: according to the number chosen as the value, independent processes are being started to parallelise (parts of) the program and therefore enhance the runtime.
-qgisProject path to qgis project file, if one should be written. A QGIS installation is required.
Type : String
Remark : optional
Description:
-activeScripts list of sub-scripts to be executed (default: ('gmpLineModeler', 'gmpLineMerge'))
Type : String
Remark : optional, default: ('gmpLineModeler', 'gmpLineMerge')
Description:
Common Package/Script Options
Settings concerning the general options for (package) scripts.
-infile input text file, directory or strip file (default: <class 'opals.tools.validators.mandatory_argument'>)
Type : String
Remark : mandatory
Description: As input either the name of an ASCII file (extension .txt) containing the names of the data files (one file per line) or an expression using wildcards to specify the respective data sets are accepted.
-outfile output directory or settings file (.txt)
Type : String
Remark : optional
Description: Specifies the directory where the final results are stored. If not specified, the results are created in the current working directory.
-tempdir temporary directory (default: current directory)
Type : String
Remark : optional, default: '.'
Description: Specifies the directory where all intermediate results are stored. If not specified, a TEMP subdirectory is created in the current working directory. Additional subdirectories (one per involved module) are created.
-projectDir project directory
Type : String
Remark : optional
Description: The default project directory is the current working directory, but can be easily changed by this parameter. All path parameters, if not specified as absolute paths, are interpreted relative to the project directory.
-skipIfExists skip processing if result already exists (default: Boolean(True))
Type : Boolean
Remark : optional, default: Boolean(True)
Description: Skip processing if result already exists. In order to re-run current script it is useful to repeat the processing only if the respective output does not already exist. This allows for incremental processing of large projects.
Possible values:
11
00
truetrue
falsefalse
yesyes
nono
Boolean(True)Boolean(True)
Boolean(False)Boolean(False)
TrueTrue
FalseFalse
LineMergeArgs
Arguments for the subscript gmpLineMerge
-tiledStructureLines Input files for subscript gmpLineMerge, only relevantif subscript gmpLineModeler is not executed. Input files need to be available as shapefiles as well as in the ODM format.
Type : String
Remark : optional
Description:
-meanDist maximum value for the mean distance between two merged lines (default: 0.35)
Type : Floating-point number
Remark : optional, default: 0.35
Description: This threshold determines the mean distance that two linesare allowed to exhibit for them to be still accepted ascorrectly merged lines
-dLength lower and upper threshold for the difference betweenthe length of the merged line and the length of theexpected merged line. (default: (-3, 0.35))
Type : Floating-point number
Remark : optional, default: (-3, 0.35)
Description: The first value needs to be below zero while thesecond one needs to be larger than zero.
-maxSearchDist maximum merging candidates search radius (default: 0.5)
Type : Floating-point number
Remark : optional, default: 0.5
Description: this value sets the maximum search radius at the endsof a line to look for merging candidates. This value shouldbe larger than meanDist as the output lines of the LineModelerexhibit some fading at the line ends.
LineModelerArgs
Arguments for the subscript gmpLineModeler
-cfg cfg file
Type : String
Remark : optional
Description: cfg file for all module calls of the subscript gmpLineModeler except LineTopology
-cfgLinetopology cfg file for the Module LineTopology of the subscript gmpLineModeler.Provide 3 different files for the three processing steps (longest, merge, longest) (default: <class 'opals.tools.validators.mandatory_argument'>)
Type : String
Remark : mandatory
Description:
Logging Options
Settings concerning the verbosity level of logging.
-fileLogLevel Log level in the logfile (default: info)
Type : LogLevel
Remark : optional, default: info
Description:
-screenLogLevel Log level on screen (default: info)
Type : LogLevel
Remark : optional, default: info
Description:
-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

The data used in the following examples can be found in the $OPALS_ROOT/demo/ directory.

Example 1

As a prerequisite for the subsequent examples, please cut the structure line demo dataset flyover.laz in tiles of size 100m with the following commands.

preTiling -vector flyover.laz -tileSize 100 -overlap 10 -export opalsGeomorphTiles -skip 0
preCutting -vector flyover.laz -shape opalsGeomorphTiles_overlap.shp -export gmp -skip 0

Now opalsGeomorph can be called using the parameters defined in the configuration files gmp_config.cfg and the three gmp_linetopology_stepx.cfg files. With the -qgisProject Parameter one can specify the path to a qgis project that should be created after the script is finished running which contains all the output shapefiles. In this example, the standard parameters of gmpLineMerge are used. See the documenation for their explanations.

opalsGeomorph -inf gmp*.odm -cfg gmp_config.cfg -cfglinetopology gmp_linetopology_step1.cfg gmp_linetopology_step2.cfg gmp_linetopology_step3.cfg -qgis demo.qgs -distribute 4

opalsGeomorph executes the two subscripts (i) gmpLineModeler.py to derive the breaklines in each tile and subsequently (ii) gmpLineMerge.py to merge the lines in the tiles to one continuous and seamless 3D breakline network. To only execute either one of those two scripts either the -subscripts parameter can be used or the individual scripts gmpLineModeler.py and gmpLineModeler may be called, respectively.

Author
gm, jo, fhackstock
Date
18.06.2023
@ overlap
specifies the overlap for sequential operations
@ vector
General vector data file (las, shp, ..)