Python script gmpLineMerge
See also
python.workflows.gmpLineMerge

Aim of module

Merges multiple structure line data sets into a single line network.

General description

The script accepts multiple line datasets derived with opalsGeomorph or gmpLineModeler, respectively, and merges all overlapping lines in to a single comprehensive 3D line network. First the overlap areas are identified and then corresponding lines in the overlapping areas are detected. Matching lines are merged by providing a smooth transition between the lines. The output is a single shape file containing the merged line network. Each line contains attributes indicating the quality of the line merging.

author: fhacksto (01-06/23)

See also
Script documentation

Parameter description

-meanDist maximum value for the mean distance between two merged lines
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.
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
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.
-qgisProject path to qgis project file, if one should be written. A QGIS installation is required.
Type : Path
Remark : optional
Common Package/Script Options
Settings concerning the general options for (package) scripts.
-infile input text file, directory or strip file
Type : Path
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 : Path
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
Type : Path
Remark : optional, default: current directory
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.
-cfg Path to configuration file
Type : Path
Remark : optional, default: $OPALS_ROOT/cfg/gmpLineMerge.cfg
Description: The name of a configuration file containing all relevant calculation parameters is expected. If not specified, the default cfg files as provided by the OPALS distribution are used.
-projectDir project directory
Type : Path
Remark : optional, default: current directory
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
Type : Boolean
Remark : optional, default: 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 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 : 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.
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

Example 1

gmpLineMerge expects a tiled breakline network, so as a prerequisite the test data set flyover.laz has to be firstly tiled in tiles with side lenghts of 100m with 10m overlap.

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 gmpLineModeler is used to derive the breaklines in each of the tiles using the parameters set in in the configuration files gmp_config.cfg and the three gmp_linetopology_stepx.cfg files.

gmpLineModeler -infile gmp*.odm -cfg gmp_config.cfg -cfgLineTopology gmp_linetopology_step1.cfg gmp_linetopology_step2.cfg gmp_linetopology_step3.cfg

Finally, gmpLineMerge can be used to merge the breaklines of the individual tiles into a seamless 3D breakline network. In this case, the standard parameters were used, please refer to the documenation above for their explanation. The final output lines of the LineModeler serve as the infiles.

gmpLineMerge -infile gmpLineModeler\finalLines\Lmod\*Final.shp -meanDist 0.35 -dLength -3 0.35 -maxSearchDist 0.5 -qgis demo.qgs
@ overlap
specifies the overlap for sequential operations
@ vector
General vector data file (las, shp, ..)