Automate Point Cloud Classification with Python
Overview
This section contains the code required to perform data preparation and point cloud classification by executing the LIS Pro 3D tools through the PySAGA API. The processing workflow also makes use of LIS Pro 3D’s Python helper module (lis_cmd.py), which provides functionality for logging and parallel processing.
If you have not yet setup LIS Pro 3D for use with Python (specifically, the PySAGA interface), please refer to our Automation Guide, particularly the section Installation of LIS Pro 3D with Python. It provides step-by-step instructions for setting up your development environment.
We recommend completing the Automation Guide before proceeding with this section. This will provide you with the necessary background knowledge to better understand the concepts and processing steps introduced here.
The provided scripts expect the following folder structure, with the input LAZ-files stored in the data folder:
project/ # top-level folder
├── scripts/
└── data/
├── 472053_5245153.laz
└── 472053_5245903.laz
Config Script
To keep our code well-structured and easily adaptable to other projects, we store project-specific information, such as file paths, filenames, and processing settings, in a separate configuration script called project_config.py.
Depending on your setup, you may need to adjust some of the file paths in this script.
Use the Copy to Clipboard button in the upper-right corner of the code block to copy the entire code block at once. Then paste the copied code into your empty project_config.py file.
Project config
import os
import sys
# LIS Pro 3D installation path
os.environ["SAGA_PATH"] = r"C:\Program Files\Laserdata\LIS Pro 3D"
sys.path.insert(0, os.environ["SAGA_PATH"])
# -----------------------------------------------------------------------------
# processing directories
BASE_DIR = r"C:\...\pc_classification"
LAS_IN_DIR = os.path.join(BASE_DIR, "data")
PROCESS_DIR = os.path.join(BASE_DIR, "processing")
SHAPES_DIR = os.path.join(PROCESS_DIR, "shapes") # shapes layers
SPC_CLASS_DIR = os.path.join(
PROCESS_DIR, "spc_class"
) # processed point cloud tiles
DELIVERY_DIR = os.path.join(
PROCESS_DIR, "delivery"
) # datasets to be delivered
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# create (non-existing) dirs
os.makedirs(PROCESS_DIR, exist_ok=True)
os.makedirs(SHAPES_DIR, exist_ok=True)
os.makedirs(SPC_CLASS_DIR, exist_ok=True)
os.makedirs(DELIVERY_DIR, exist_ok=True)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# global settings: files, tool parameters, ...
PROC_UNITS = os.path.join(SHAPES_DIR, "processing_units.shp")
DELIVERY_UNITS = os.path.join(SHAPES_DIR, "delivery_units.shp")
LASVF = os.path.join(LAS_IN_DIR, "tiles.lasvf")
SPCVF_CLASS = os.path.join(SPC_CLASS_DIR, "tiles.spcvf")
# EPSG:2056 — CH1903+ / LV95 (Swiss projected coordinate system)
PROJ = "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs"
# tile sizes for processing and delivery
TILE_SIZE_PROCESSING = 100.0
TILE_SIZE_DELIVERY = 250.0 # just as an example for our small tutorial dataset
# processing overlap
TILE_OVERLAP = 30.0
# outlier removal
SEARCH_RADIUS_OUTLIER = 3.0
# ground classification
GRD_INITIAL_CELLSIZE = 50.0
GRD_FINAL_CELLSIZE = 0.5
GRD_MAX_ANGLE = 35.0
GRD_MAX_DISTANCE = 0.8
# building classification
SEARCH_RADIUS = 1.0
# powerline classification
SEARCH_RADIUS_PL = 5.0
MIN_WIRE_LENGTH = 10.0
# pylon classification
MIN_PYLON_HEIGHT = 20.0Set the BASEDIR path to point to your top-level project folder.
Data Preparation Script
The data preparation script performs the following tasks:
- Creates spatial indexes for the input *.laz files.
- Creates a point cloud data catalog referencing the input files.
- Creates tiling schemes for processing and data delivery.
Complete code
import os
import project_config as cfg
from PySAGA import saga_api, lis_cmd
from PySAGA.tools import *
def prepare_data():
# -----------------------------------------------------------------------------
# create a list of all LAS/LAZ input files in the data folder
inputfiles = lis_cmd.Create_File_List(
cfg.LAS_IN_DIR,
".las;.laz",
os.path.join(cfg.LAS_IN_DIR, "lasvf_input_file_list.txt"),
)
# -----------------------------------------------------------------------------
# create spatial indexes for all LAS/LAZ files
if not lis_io.Create_LASLAZ_Index(
FILES="",
INPUT_FILE_LIST=inputfiles,
INDEX_ALL=True,
TILE_SIZE=0.000000,
THRESHOLD=1000,
MIN_POINTS=100000,
MAX_INTERVALS=-20,
):
return lis_cmd.Error_Return("Failed to execute tool")
# -----------------------------------------------------------------------------
# create a point cloud data catalog from the LAS/LAZ files
if not lis_virtual.Create_Virtual_LASLAZ_Dataset(
FILES="",
INPUT_FILE_LIST=inputfiles,
FILENAME=cfg.LASVF,
METHOD_PATHS="relative",
COLOR_DEPTH="16 bit",
):
return lis_cmd.Error_Return("Failed to execute tool")
# -----------------------------------------------------------------------------
# retrieve the bounding boxes of the tiles in the virtual point cloud dataset
tileshape_vf = saga_api.SG_Get_Data_Manager().Add_Shapes()
if not lis_virtual.Create_Tileshape_from_Virtual_LASLAZ(
TILE_SHP=tileshape_vf, FILENAME=cfg.LASVF
):
return lis_cmd.Error_Return("Failed to execute tool")
# -----------------------------------------------------------------------------
# create a (small) tiling scheme for data processing
proc_units = saga_api.SG_Get_Data_Manager().Add_Shapes()
if not lis_tools.Create_Spatial_Processing_Units(
SHP_EXTENT=tileshape_vf,
SHP_UNITS=proc_units,
ROUND_ORIGIN=True,
TILE_SIZE=cfg.TILE_SIZE_PROCESSING,
METHOD_SUBDIVISION="none",
):
return lis_cmd.Error_Return("Failed to execute tool")
proc_units.Set_Name("processing_units")
proc_units.Get_Projection().Create(cfg.PROJ)
proc_units.Save(cfg.PROC_UNITS)
# -----------------------------------------------------------------------------
# create a (larger) tiling scheme for data export
delivery_units = saga_api.SG_Get_Data_Manager().Add_Shapes()
if not lis_tools.Create_Spatial_Processing_Units(
SHP_EXTENT=tileshape_vf,
SHP_UNITS=delivery_units,
ROUND_ORIGIN=True,
TILE_SIZE=cfg.TILE_SIZE_DELIVERY,
METHOD_SUBDIVISION="none",
):
return lis_cmd.Error_Return("Failed to execute tool")
delivery_units.Set_Name("delivery_units")
delivery_units.Get_Projection().Create(cfg.PROJ)
delivery_units.Save(cfg.DELIVERY_UNITS)
# -----------------------------------------------------------------------------
return True
if __name__ == "__main__":
# -----------------------------------------------------------------------------
# start the logging
starttime = lis_cmd.Start_Logging(False)
# -----------------------------------------------------------------------------
# call the data preparation function
if not prepare_data():
lis_cmd.Error_Exit("Processing task failed", starttime)
# -----------------------------------------------------------------------------
# stop logging
lis_cmd.Stop_Logging(starttime)Copy the code into to a file named data_preparation.py and run the script.
Processing Script
The process_unit function in the processing script performs the following steps for each processing unit:
- Queries the point cloud for the current tile, including the specified overlap, from the virtual point cloud dataset.
- Filters noise points.
- Classifies ground points.
- Detects planar surfaces for building roof identification.
- Classifies building and vegetation points.
- Cleans building facades.
- Cleans building roofs.
- Classifies power lines.
- Classifies pylons.
- Removes point cloud overlap.
- Saves tile to disk.
Each processing unit (red square) is processed together with an additional surrounding area, referred to as the overlap (red dotted square). This helps to avoid edge effects during processing.
At the end of the process_unit function, the overlap is removed, and only the points belonging to the original tile (red square) are saved to disk.
This ensures that the processed tiles collectively cover the entire project area without gaps or overlapping areas. Finally, we can create a point cloud data catalog referencing the processed tiles, providing convenient access to the final classification results.
Each processing unit is saved using a unique filename based on the coordinates of the lower-left corner of its spatial extent.
Complete code
import os
import project_config as cfg
from PySAGA import saga_api, lis_cmd
from PySAGA.tools import *
@lis_cmd.proc_function_wrapper
def process_unit(unit_index=0):
# -----------------------------------------------------------------------------
# load the vector layer with the tiling scheme used for processing
processing_units = saga_api.SG_Get_Data_Manager().Add_Shapes(
cfg.PROC_UNITS
)
if not processing_units:
return lis_cmd.Error_Return(f"Loading {cfg.PROC_UNITS} failed")
# -----------------------------------------------------------------------------
# get tile to process
proc_unit = processing_units.Get_Shape(unit_index)
xmin = proc_unit.Get_Extent().Get_XMin()
ymin = proc_unit.Get_Extent().Get_YMin()
xmax = proc_unit.Get_Extent().Get_XMax()
ymax = proc_unit.Get_Extent().Get_YMax()
# units are referenced by their lower-left corner coordinate
unit_name = f"{int(xmin)}_{int(ymin)}"
lis_cmd.Message_Print(f"\nProcessing unit {unit_name}\n")
# -----------------------------------------------------------------------------
# query point cloud (with overlap) from virtual point cloud dataset
pc_out_list = []
if not lis_virtual.Get_Subset_from_Virtual_LASLAZ(
PC_OUT=pc_out_list,
FILENAME=cfg.LASVF,
COPY_ATTR=True,
CONSTRAIN_QUERY=False,
FILE_COMPRESSION=True,
ERROR_IF_EMPTY=True,
THIN_OUT=True,
SPACING=0.01,
AOI_XRANGE=f"{xmin};{xmax}",
AOI_YRANGE=f"{ymin};{ymax}",
AOI_ADD_OVERLAP=True,
OVERLAP=cfg.TILE_OVERLAP,
SKIP_EMPTY_AOIS=True,
METHOD_CLIP="lower and left boundary is inside",
):
return lis_cmd.Error_Return("Tool execution failed")
if len(pc_out_list) < 1:
return lis_cmd.Error_Return(
f"Unit {unit_name} contains no point cloud data, skipping!"
)
# add the point cloud dataset to the data manager for easier memory management
pc_buff = saga_api.SG_Get_Data_Manager().Add(pc_out_list[0]).asPointCloud()
if pc_buff.Get_Count() < 5:
saga_api.SG_Get_Data_Manager().Delete(pc_buff)
return lis_cmd.Error_Return(
f"Unit {unit_name} has less than 5 points, skipping ..."
)
# -----------------------------------------------------------------------------
# filter noise points
if not lis_filtering.Remove_Isolated_Points(
PC_IN=pc_buff,
COPY_ATTR=True,
SEARCH_RADIUS=cfg.SEARCH_RADIUS_OUTLIER,
MAX_POINTS=2,
METHOD="label points",
ATTR_NAME="noise",
CLASSID=7,
CLASSID_UNDEF=1,
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# ground classification
if not lis_classification.Ground_Classification(
PC_IN=pc_buff,
FIELD_CLASS="noise",
COPY_ATTR=True,
INIT_CELLSIZE=cfg.GRD_INITIAL_CELLSIZE,
FINAL_CELLSIZE=cfg.GRD_FINAL_CELLSIZE,
FILTER_SEEDS=False,
TERRAIN_ANGLE=88,
MIN_EDGE_LENGTH=cfg.GRD_FINAL_CELLSIZE,
MAX_ANGLE=cfg.GRD_MAX_ANGLE,
MAX_DISTANCE=cfg.GRD_MAX_DISTANCE,
Z_TOLERANCE=0.05,
ATTACH_DZ=True,
EXCLUDE_CLASSES="7",
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# detect planar surfaces for building roof identification
if not lis_segmentation.Segmentation_by_Plane_Growing(
PC_IN=pc_buff,
FILTER_FIELD="grdclass",
COPY_ATTR=True,
LOW_RANGE="0;1",
HIGH_RANGE="3;64",
METHOD_NN="radius",
RADIUS_NN=cfg.SEARCH_RADIUS,
MIN_K=3,
ROBUST=True,
ROBUST_THRES=0.1,
ROBUST_PERCENTAGE=50.0,
METHOD_ROBUST_SEARCH_POINT="search point must be included in best fit plane",
GROWING_RADIUS=cfg.SEARCH_RADIUS / 2.0,
GROWING_PLANE_DIST=0.1,
SEG_ITERATIONS=1,
REGION_RADIUS=cfg.SEARCH_RADIUS,
REGION_MINSIZE=20,
REGION_MAXSIZE=100000,
REGION_MAXANGLE=10,
REGION_MAXOFFSET=0.2,
REGION_RECALC_NORMAL=100000,
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# building and vegetation classification
if not lis_classification.Enhanced_Point_Cloud_Classification(
PC_IN=pc_buff,
FIELD_SEGMENTID="segmentid",
FIELD_CLASSID_GROUND="grdclass",
FIELD_DZ="dz",
COPY_ATTR=True,
EXCLUDE_CLASSES="7",
METHOD_BUILDING="point cloud features",
MIN_DZ_BUILDING=2.0,
GROWING_RADIUS_BUILDING=cfg.SEARCH_RADIUS,
FEATURE_RADIUS_BUILDING=cfg.SEARCH_RADIUS,
MIN_NEIGHBOR_RATIO_BUILDING=60.0,
SLOPE_ADAPTIVE_RATIO=False,
MIN_POINTS_BUILDING=200,
RADIUS_VEGETATION=cfg.SEARCH_RADIUS * 2.0,
MIN_POINTS_VEGETATION=5,
MIN_DZ_LOW_VEGETATION=0,
MIN_DZ_MEDIUM_VEGETATION=0.3,
MIN_DZ_HIGH_VEGETATION=2,
OUTPUT_CALIBRATION=False,
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# clean building facades
if not lis_classification.Clean_Building_Facades(
PC_IN=pc_buff,
FIELD_FILTERATTR="classid",
COPY_ATTR=True,
ATTR_SUFFIX="facades",
RADIUS_NN=cfg.SEARCH_RADIUS,
BUILDING_CLASS="6;6",
LOW_ATTR_RANGE="3;5",
HIGH_ATTR_RANGE="7;64",
TARGET_CLASS=1,
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# clean building roofs
if not lis_classification.Clean_Building_Roofs(
PC_IN=pc_buff,
FIELD_FILTERATTR="classid_facades",
COPY_ATTR=True,
ATTR_SUFFIX="roofs",
DIMENSION="3D search",
RADIUS_NN=2.5,
USE_INNER_RADIUS=False,
FILTER_CLASSES="4;5",
TARGET_CLASS=1,
THRES_MAJORITY=25,
EXCLUDED_CLASSES="0;1;2",
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# power line classification
if not lis_classification.Power_Line_Classification(
PC_IN=pc_buff,
FIELD_CLASS="classid_facades_roofs",
FIELD_THRES="dz",
COPY_ATTR=True,
ATTR_SUFFIX="pl",
FILTER_CABLES=True,
CABLE_CLUSTER_RADIUS=cfg.SEARCH_RADIUS * 3,
MIN_CABLE_LENGTH=cfg.MIN_WIRE_LENGTH,
EXCLUDE_CLASSES="2;6;9",
THRES_RANGE="3.5;1000",
SEARCH_RADIUS=cfg.SEARCH_RADIUS_PL,
CLASSIFY_POLES=False,
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# pylon classification
if not lis_classification.Pylon_Classification(
PC_IN=pc_buff,
FIELD_CLASS="classid_pl",
FIELD_DZ="dz",
COPY_ATTR=True,
ATTR_SUFFIX="final",
MIN_PYLON_HEIGHT=cfg.MIN_PYLON_HEIGHT,
MAX_PYLON_DIAMETER=25.0,
RADIUS_NN=3.0,
MAX_DIFFERENCE=2.0,
MIN_POINTS=200,
SEED_CLASS=14,
EXCLUDE_CLASSES="",
OUTPUT_CALIBRATION=False,
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# remove tile overlap
pc_out = saga_api.SG_Get_Data_Manager().Add_PointCloud()
if not lis_tools.Clip_Point_Cloud_with_Extent(
PC_IN=pc_buff,
PC_OUT=pc_out,
X_EXTENT=f"{xmin};{xmax}",
Y_EXTENT=f"{ymin};{ymax}",
METHOD_CLIP="lower and left boundary is inside",
):
return lis_cmd.Error_Return("Tool execution failed")
saga_api.SG_Get_Data_Manager().Delete(pc_buff)
# -----------------------------------------------------------------------------
# save classified tile (without overlap)
pc_out.Set_Name(f"tile_{unit_name}")
pc_out.Get_Projection().Create(saga_api.CSG_String(cfg.PROJ))
pc_out.Save(
os.path.join(cfg.SPC_CLASS_DIR, pc_out.Get_Name() + ".sg-pts-z")
)
# -----------------------------------------------------------------------------
# free memory resources and return success
saga_api.SG_Get_Data_Manager().Delete(pc_out)
return True
if __name__ == "__main__":
# -----------------------------------------------------------------------------
# start the logging
starttime = lis_cmd.Start_Logging(False)
# -----------------------------------------------------------------------------
# load the vector layer with the tiling scheme used for processing
processing_units = saga_api.SG_Get_Data_Manager().Add_Shapes(
cfg.PROC_UNITS
)
if not processing_units:
lis_cmd.Error_Exit(f"Loading {cfg.PROC_UNITS} failed", starttime)
lis_cmd.Message_Print(
f"Number of units to process: {processing_units.Get_Count()}\n\n"
)
# -----------------------------------------------------------------------------
# run the process_unit function in parallel (one unit per CPU thread)
# with the maximum number of available threads
num_threads = saga_api.SG_OMP_Get_Max_Num_Threads()
lis_cmd.Message_Print(
f"Number of threads for parallized processing: {num_threads}\n\n"
)
lis_cmd.Run_Parallel_Tasks(
process_unit, processing_units.Get_Count(), num_threads
)
# -----------------------------------------------------------------------------
# create a point cloud data catalog from the classified tiles
# for subsequent processing steps
inputfiles = lis_cmd.Create_File_List(
cfg.SPC_CLASS_DIR,
".sg-pts;.sg-pts-z",
os.path.join(cfg.SPC_CLASS_DIR, "spcvf_input_file_list.txt"),
)
if not lis_virtual.Create_Virtual_Point_Cloud_Dataset(
INPUT_FILE_LIST=inputfiles,
FILENAME=cfg.SPCVF_CLASS,
METHOD_PATHS=1,
USE_HEADER=True,
):
lis_cmd.Error_Exit("Failed to execute tool", starttime)
# -----------------------------------------------------------------------------
# free memory and stop logging
saga_api.SG_Get_Data_Manager().Delete()
lis_cmd.Stop_Logging(starttime)Copy the code into a file named data_processing.py and run the script.
Data Export Script
Finally, we will export the classified point cloud back to *.laz files. In most cases, the delivery tiling scheme differs from the one used for data processing, typically consisting of considerably larger tiles.
The process_unit function in the data export script performs the following steps for each delivery unit:
- Queries the point cloud (without overlap) for the current delivery unit from the virtual point cloud dataset.
- Exports the resulting point cloud in *.laz format.
Complete code
import os
import project_config as cfg
from PySAGA import saga_api, lis_cmd
from PySAGA.tools import *
@lis_cmd.proc_function_wrapper
def process_unit(unit_index=0):
# -----------------------------------------------------------------------------
# load the vector layer with the tiling scheme used for delivery
processing_units = saga_api.SG_Get_Data_Manager().Add_Shapes(
cfg.DELIVERY_UNITS
)
if not processing_units:
return lis_cmd.Error_Return(f"Loading {cfg.DELIVERY_UNITS} failed")
# -----------------------------------------------------------------------------
# get tile to process
proc_unit = processing_units.Get_Shape(unit_index)
xmin = proc_unit.Get_Extent().Get_XMin()
ymin = proc_unit.Get_Extent().Get_YMin()
xmax = proc_unit.Get_Extent().Get_XMax()
ymax = proc_unit.Get_Extent().Get_YMax()
# units are referenced by their lower-left corner coordinate
unit_name = f"{int(xmin)}_{int(ymin)}"
lis_cmd.Message_Print(f"\nProcessing unit {unit_name}\n")
# -----------------------------------------------------------------------------
# query point cloud (without overlap) from virtual point cloud dataset
pc_out_list = []
if not lis_virtual.Get_Subset_from_Virtual_Point_Cloud(
PC_OUT=pc_out_list,
FILENAME=cfg.SPCVF_CLASS,
FILEPATH="",
FILE_COMPRESSION=True,
COPY_ATTR=True,
DATASETID=False,
CONSTRAIN_QUERY=False,
THIN_OUT=False,
ERROR_IF_EMPTY=False,
AOI_XRANGE=f"{xmin};{xmax}",
AOI_YRANGE=f"{ymin};{ymax}",
AOI_ADD_OVERLAP=False,
SKIP_EMPTY_AOIS=True,
METHOD_CLIP="lower and left boundary is inside",
ONE_PC_PER_POLYGON=False,
):
return lis_cmd.Error_Return("Tool execution failed")
if len(pc_out_list) < 1:
return lis_cmd.Error_Return(
f"Unit {unit_name} contains no point cloud data, skipping!"
)
# add the point cloud dataset to the data manager for easier memory management
pc = saga_api.SG_Get_Data_Manager().Add(pc_out_list[0]).asPointCloud()
# -----------------------------------------------------------------------------
# export LAZ file
if not lis_io.Export_LASLAZ_File(
POINTS=pc,
T="gps-time",
r="number of the return",
n="number of returns of given pulse",
i="intensity",
c="classid_final",
CFLAGS="<not set>",
SYNTHETIC="<not set>",
KEYPOINT="<not set>",
WITHHELD="<not set>",
OVERLAP="<not set>",
a="scan angle",
d="direction of scan flag",
e="edge of flight line flag",
u="user data",
p="point source ID",
REB=False,
EXTRABYTES="<no attributes>",
FILE=os.path.join(cfg.DELIVERY_DIR, f"{unit_name}.laz"),
FILE_FORMAT="LAS 1.4",
FORMAT="1",
OFF_X=470000.000000,
OFF_Y=5240000.000000,
OFF_Z=0.000000,
SCALE_X=0.001000,
SCALE_Y=0.001000,
SCALE_Z=0.001000,
):
return lis_cmd.Error_Return("Tool execution failed")
# -----------------------------------------------------------------------------
# free memory resources and return success
saga_api.SG_Get_Data_Manager().Delete(pc)
return True
if __name__ == "__main__":
# -----------------------------------------------------------------------------
# start the logging
starttime = lis_cmd.Start_Logging(False)
# -----------------------------------------------------------------------------
# load the vector layer with the tiling scheme used for delivery
processing_units = saga_api.SG_Get_Data_Manager().Add_Shapes(
cfg.DELIVERY_UNITS
)
if not processing_units:
lis_cmd.Error_Exit(f"Loading {cfg.DELIVERY_UNITS} failed", starttime)
lis_cmd.Message_Print(
f"Number of units to process: {processing_units.Get_Count()}\n\n"
)
# -----------------------------------------------------------------------------
# run the process_unit function in parallel (one unit per CPU thread)
# with the maximum number of available threads
num_threads = saga_api.SG_OMP_Get_Max_Num_Threads()
lis_cmd.Message_Print(
f"Number of threads for parallized processing: {num_threads}\n\n"
)
lis_cmd.Run_Parallel_Tasks(
process_unit, processing_units.Get_Count(), num_threads
)
# -----------------------------------------------------------------------------
# free memory and stop logging
saga_api.SG_Get_Data_Manager().Delete()
lis_cmd.Stop_Logging(starttime)Copy the code into a file named data_export.py and run the script.
Recap
In this section, we have presented an automated point cloud classification workflow using LIS Pro 3D. Processing the data tile by tile allows the workflow to be applied to large projects with only minimal modifications to the code.