Urban Forestry API

Module: mls.urban_forest. This page documents 12 public functions with exact tool IDs, complete parameters, Parameters fields, and examples.

Back to the Script Tool API Reference

Functions

  • monomer_config_urban_forest — Used for global configuration of the Urban Forest Module, including ground point classes, crown diameter type, DBH fit method, DBH height, DBH range, and forest render settings
  • monomer_transform_seed — Convert general vector points in the tree layer to individual tree seed points, enabling tree segmentation and parameter measurement
  • monomer_update_seed — Update seed points from point cloud TreeID information. Creates new seeds for trees with TreeID but no seed point, and updates existing seed positions
  • monomer_compute_dbh_height — Compute DBH (Diameter at Breast Height) and tree height for individual trees using a cylindrical search region centered on seed points
  • monomer_tree_segmentation — Segment individual trees from point cloud. The process consists of seed point generation and growth from seeds
  • monomer_cal_param — Calculate tree parameters for individual trees including DBH, height, angle, crown length, crown width, crown diameter, north-south crown, east-west crown, volume, and area
  • monomer_tree_report — Export individual tree report as HTML file with tree list, statistical information, and images. If successful, prompt the user whether to open it in the default browser
  • monomer_clear_treeid — Clear Tree ID values from point cloud without removing related vector seed points
  • monomer_extract_cloud_by_treeid — Extract point cloud by target Tree ID. Supports three extraction modes: ALL (0), BY_RANGE (1), BY_CSV (2). Output can be single or multiple files in LiData or CSV format
  • monomer_add_properties_by_table — Add additional properties to point cloud by associating point cloud TreeID with tree seed point Object ID. Properties from specified table fields are written as scalar fields
  • monomer_import_seed_tool — Import tree seeds from a TXT/CSV file with configurable column indices for ObjectID, X, Y, Z, DBH, and Height. After import, use stepControl GROW mode of Tree_Segmentation to obtain tree point clouds
  • monomer_statistical_clearance_points — Statistical clearance points for individual trees. Analyzes the clearance space around each tree and records statistical results

monomer_config_urban_forest

Used for global configuration of the Urban Forest Module, including ground point classes, crown diameter type, DBH fit method, DBH height, DBH range, and forest render settings

  • Exact tool ID:Monomer_Config_Urban_Forest
  • Recommended call:mls.urban_forest.monomer_config_urban_forest(...)
  • Alias:Monomer_Config_Urban_Forest
  • Required parameters: None

Parameters

Parameter Type Required Default Description
groundClass object No — Ground point classes. Each object value is a class ID in range 0-255.
crown_diameter_type integer No 1 Crown diameter type. 0: fit by average, 1: fit by circle, 2: fit by ellipse
dbh_fit_method integer No 0 DBH fit method. 0: fit by circle, 1: fit by ellipse, 2: fit by cylinder
dbh_height number No 1.3 Default DBH measurement height (must be greater than zero)
min_DBH number No 0.05 Minimum DBH value. Seed points with DBH smaller than this will be filtered out (must be greater than zero and smaller than max_DBH)
max_DBH number No 2.0 Maximum DBH value. Seed points with DBH greater than this will be filtered out (must be greater than min_DBH)
forest_render boolean No True Master switch for forest render. true: show, false: do not show
show_DBH boolean No True Whether to show DBH in forest render. true: show, false: do not show
show_CD boolean No True Whether to show Crown Diameter in forest render. true: show, false: do not show
show_height boolean No True Whether to show Height in forest render. true: show, false: do not show

Example

from gvscript import mls

result = mls.urban_forest.monomer_config_urban_forest(
    groundClass={},
    crown_diameter_type=1,
    dbh_fit_method=0,
    dbh_height=1.3,
    min_DBH=0.05,
    max_DBH=2.0,
    forest_render=True,
    show_DBH=True,
    show_CD=True,
    show_height=True,
)
print(result.ok, result.output, result.message)

monomer_transform_seed

Convert general vector points in the tree layer to individual tree seed points, enabling tree segmentation and parameter measurement

  • Exact tool ID:Monomer_Transform_Seed
  • Recommended call:mls.urban_forest.monomer_transform_seed(...)
  • Alias:Monomer_Transform_Seed
  • Required parameters: None

Parameters

Parameter Type Required Default Description
— — — — This function does not accept any function-specific parameters.

Example

from gvscript import mls

result = mls.urban_forest.monomer_transform_seed(
)
print(result.ok, result.output, result.message)

monomer_update_seed

Update seed points from point cloud TreeID information. Creates new seeds for trees with TreeID but no seed point, and updates existing seed positions

  • Exact tool ID:Monomer_Update_Seed
  • Recommended call:mls.urban_forest.monomer_update_seed(...)
  • Alias:Monomer_Update_Seed
  • Required parameters:input_paths

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths

Example

from gvscript import mls

result = mls.urban_forest.monomer_update_seed(
    input_paths=['D:/data/input.LiData'],
)
print(result.ok, result.output, result.message)

monomer_compute_dbh_height

Compute DBH (Diameter at Breast Height) and tree height for individual trees using a cylindrical search region centered on seed points

  • Exact tool ID:Monomer_Compute_DBH_Height
  • Recommended call:mls.urban_forest.monomer_compute_dbh_height(...)
  • Alias:Monomer_Compute_DBH_Height
  • Required parameters:input_paths

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths
cylinderRadius number No 1.0 Cylinder search radius centered on seed point
cylinderAboveHeight number No 10.0 Upward search height from seed point
cylinderBelowHeight number No 10.0 Downward search height from seed point
calDBH boolean No True Whether to calculate DBH. true: calculate, false: do not calculate
calHeight boolean No True Whether to calculate height. true: calculate, false: do not calculate

Example

from gvscript import mls

result = mls.urban_forest.monomer_compute_dbh_height(
    input_paths=['D:/data/input.LiData'],
    cylinderRadius=1.0,
    cylinderAboveHeight=10.0,
    cylinderBelowHeight=10.0,
    calDBH=True,
    calHeight=True,
)
print(result.ok, result.output, result.message)

monomer_tree_segmentation

Segment individual trees from point cloud. The process consists of seed point generation and growth from seeds

  • Exact tool ID:Monomer_Tree_Segmentation
  • Recommended call:mls.urban_forest.monomer_tree_segmentation(...)
  • Alias:Monomer_Tree_Segmentation
  • Required parameters:input_paths

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths
stepControl integer No 2 Segmentation step control. 0: generate seeds only, 1: segment with existing seeds, 2: generate seeds and segment (full process)
initBranchHeight number No 1.3 Initial branch/trunk height for seed generation
initBranchThickness number No 0.2 Initial branch/trunk thickness for seed generation
heightMininum number No 2.0 Minimum tree height filter
heightAboveGround number No 0.3 Height above ground for growth start point
useHeightAboveGround boolean No False Whether to use height above ground for growth. true: use, false: do not use
maxClusterRadius number No 0.2 Maximum clustering radius for seed generation
minClusterSize integer No 100 Minimum cluster point count

Example

from gvscript import mls

result = mls.urban_forest.monomer_tree_segmentation(
    input_paths=['D:/data/input.LiData'],
    stepControl=2,
    initBranchHeight=1.3,
    initBranchThickness=0.2,
    heightMininum=2.0,
    heightAboveGround=0.3,
    useHeightAboveGround=False,
    maxClusterRadius=0.2,
    minClusterSize=100,
)
print(result.ok, result.output, result.message)

monomer_cal_param

Calculate tree parameters for individual trees including DBH, height, angle, crown length, crown width, crown diameter, north-south crown, east-west crown, volume, and area

  • Exact tool ID:Monomer_Cal_Param
  • Recommended call:mls.urban_forest.monomer_cal_param(...)
  • Alias:Monomer_Cal_Param
  • Required parameters:input_paths

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths
calDBH boolean No False Whether to calculate DBH. true: calculate, false: do not calculate
calHeight boolean No False Whether to calculate height. true: calculate, false: do not calculate
calAngle boolean No True Whether to calculate angle (inclination). true: calculate, false: do not calculate
calCD boolean No True Whether to calculate crown diameter. true: calculate, false: do not calculate
calCL boolean No True Whether to calculate crown length. true: calculate, false: do not calculate
calCW boolean No True Whether to calculate crown width. true: calculate, false: do not calculate
calSN boolean No True Whether to calculate north-south crown diameter. true: calculate, false: do not calculate
calEW boolean No True Whether to calculate east-west crown diameter. true: calculate, false: do not calculate
calVolume boolean No True Whether to calculate volume. true: calculate, false: do not calculate
calArea boolean No True Whether to calculate area. true: calculate, false: do not calculate

Example

from gvscript import mls

result = mls.urban_forest.monomer_cal_param(
    input_paths=['D:/data/input.LiData'],
    calDBH=False,
    calHeight=False,
    calAngle=True,
    calCD=True,
    calCL=True,
    calCW=True,
    calSN=True,
    calEW=True,
    calVolume=True,
    calArea=True,
)
print(result.ok, result.output, result.message)

monomer_tree_report

Export individual tree report as HTML file with tree list, statistical information, and images. If successful, prompt the user whether to open it in the default browser

  • Exact tool ID:Monomer_Tree_Report
  • Recommended call:mls.urban_forest.monomer_tree_report(...)
  • Alias:Monomer_Tree_Report
  • Required parameters:input_paths, htmlPath

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths
htmlPath string Yes — Output path for the HTML report file. Default is the current project directory with filename tree.html

Example

from gvscript import mls

result = mls.urban_forest.monomer_tree_report(
    input_paths=['D:/data/input.LiData'],
    htmlPath='D:/data/input.LiData',
)
print(result.ok, result.output, result.message)

monomer_clear_treeid

Clear Tree ID values from point cloud without removing related vector seed points

  • Exact tool ID:Monomer_Clear_TreeID
  • Recommended call:mls.urban_forest.monomer_clear_treeid(...)
  • Alias:Monomer_Clear_TreeID
  • Required parameters:input_paths

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths

Example

from gvscript import mls

result = mls.urban_forest.monomer_clear_treeid(
    input_paths=['D:/data/input.LiData'],
)
print(result.ok, result.output, result.message)

monomer_extract_cloud_by_treeid

Extract point cloud by target Tree ID. Supports three extraction modes: ALL (0), BY_RANGE (1), BY_CSV (2). Output can be single or multiple files in LiData or CSV format

  • Exact tool ID:Monomer_Extract_Cloud_By_TreeID
  • Recommended call:mls.urban_forest.monomer_extract_cloud_by_treeid(...)
  • Alias:Monomer_Extract_Cloud_By_TreeID
  • Required parameters:input_paths

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths
extractType integer No 0 Extraction type. 0: extract all trees, 1: extract trees by ID range, 2: extract trees by CSV file list
treeIDMin integer No 1 Minimum Tree ID (required when extractType is 1)
treeIDMax integer No 100000 Maximum Tree ID (required when extractType is 1)
treeIDFile string No — CSV file path containing Tree ID list (required when extractType is 2)
singleFile boolean No False Export all trees to a single file. true: single file, false: separate files per tree
outputFile string No — Output file path (required when singleFile is true). Default is current project directory with filename extract_by_treeID_merged
outputDir string No — Output directory path (required when singleFile is false). Default is current project directory
outputFormat integer No 0 Output file format. 0: .LiData, 1: .csv

Example

from gvscript import mls

result = mls.urban_forest.monomer_extract_cloud_by_treeid(
    input_paths=['D:/data/input.LiData'],
    extractType=0,
    treeIDMin=1,
    treeIDMax=100000,
    treeIDFile='example',
    singleFile=False,
    outputFile='example',
    outputDir='example',
    outputFormat=0,
)
print(result.ok, result.output, result.message)

monomer_add_properties_by_table

Add additional properties to point cloud by associating point cloud TreeID with tree seed point Object ID. Properties from specified table fields are written as scalar fields

  • Exact tool ID:Monomer_Add_Properties_By_Table
  • Recommended call:mls.urban_forest.monomer_add_properties_by_table(...)
  • Alias:Monomer_Add_Properties_By_Table
  • Required parameters:input_paths, propertyNames

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths
propertyNames array Yes — List of property field names from tree layer to add. Automatically list available fields for the user to select

Example

from gvscript import mls

result = mls.urban_forest.monomer_add_properties_by_table(
    input_paths=['D:/data/input.LiData'],
    propertyNames=['example_name'],
)
print(result.ok, result.output, result.message)

monomer_import_seed_tool

Import tree seeds from a TXT/CSV file with configurable column indices for ObjectID, X, Y, Z, DBH, and Height. After import, use stepControl GROW mode of Tree_Segmentation to obtain tree point clouds

  • Exact tool ID:Monomer_Import_Seed_Tool
  • Recommended call:mls.urban_forest.monomer_import_seed_tool(...)
  • Alias:Monomer_Import_Seed_Tool
  • Required parameters:filePath

Parameters

Parameter Type Required Default Description
filePath string Yes — Path to the seed point TXT/CSV file
seperator string No ',' Column separator character
numLinesToSkip integer No 1 Number of header lines to skip
objectIDIndex integer No 2 Column index for Object ID (0-based)
xIndex integer No 3 Column index for X coordinate (0-based)
yIndex integer No 4 Column index for Y coordinate (0-based)
zIndex integer No 5 Column index for Z coordinate (0-based)
DBHIndex integer No 6 Column index for DBH value (0-based)
HeightIndex integer No 7 Column index for Height value (0-based)

Example

from gvscript import mls

result = mls.urban_forest.monomer_import_seed_tool(
    filePath='D:/data/input.LiData',
    seperator=',',
    numLinesToSkip=1,
    objectIDIndex=2,
    xIndex=3,
    yIndex=4,
    zIndex=5,
    DBHIndex=6,
    HeightIndex=7,
)
print(result.ok, result.output, result.message)

monomer_statistical_clearance_points

Statistical clearance points for individual trees. Analyzes the clearance space around each tree and records statistical results

  • Exact tool ID:Monomer_Statistical_Clearance_Points
  • Recommended call:mls.urban_forest.monomer_statistical_clearance_points(...)
  • Alias:Monomer_Statistical_Clearance_Points
  • Required parameters:input_paths

Parameters

Parameter Type Required Default Description
input_paths array Yes — Input point cloud file paths, supports single or multiple paths

Example

from gvscript import mls

result = mls.urban_forest.monomer_statistical_clearance_points(
    input_paths=['D:/data/input.LiData'],
)
print(result.ok, result.output, result.message)

results matching ""

    No results matching ""