Road Terrain API
Module: mls.road_terrain. This page documents 4 public functions with exact tool IDs, complete parameters, Parameters fields, and examples.
Back to the Script Tool API Reference
Functions
pointcloud_to_dem
Based on point cloud, generate DEM in tif format.
- Exact tool ID:
RoadTerrain_PointCloud_To_DEM
- Recommended call:
mls.road_terrain.pointcloud_to_dem(...)
- Alias:
PointCloud_To_DEM
- Required parameters:
input_paths, Parameters
Parameters
| Parameter |
Type |
Required |
Default |
Description |
input_paths |
array |
Yes |
— |
REQUIRED when user provides 2+ files. Put ALL file paths here. |
Parameters |
object |
Yes |
— |
DEM generation parameters |
Parameters fields
| Field |
Type |
Required |
Default |
Description |
fromClass |
array |
No |
[2] |
Point classification codes to use. Example: [2, 5]. |
type |
integer |
No |
1 |
None |
resultType |
integer |
No |
0 |
None |
exportMode |
integer |
No |
0 |
Output mode. 0 = By Resolution, 1 = By Scale. |
cellSize |
number |
Yes |
2.0 |
Output raster resolution. When exportMode is 1, derive this from tileScale: 500->0.05, 1000->0.1, 2000->0.2, 5000->0.5. |
tileScale |
integer |
No |
1000 |
Tile scale used when exportMode is 1. |
tileBuffer |
number |
No |
10.0 |
Tile buffer used when exportMode is 1. |
fillHole |
boolean |
No |
True |
Whether to automatically fill small gaps |
asSingle |
boolean |
No |
False |
Merge all point clouds into a single raster when exportMode is 0. |
outPutDir |
string |
Yes |
— |
The save location for the output image |
Example
from gvscript import mls
params = mls.road_terrain.pointcloud_to_dem_parameters()
params.fromClass = [2]
result = mls.road_terrain.pointcloud_to_dem(
Parameters=params,
input_paths=['D:/data/input.LiData'],
)
print(result.ok, result.output, result.message)
pointcloud_to_contour
Generate contour lines from point cloud or raster data.
- Exact tool ID:
RoadTerrain_PointCloud_To_Contour
- Recommended call:
mls.road_terrain.pointcloud_to_contour(...)
- Alias:
PointCloud_To_Contour
- Required parameters:
input_paths, Parameters
Parameters
| Parameter |
Type |
Required |
Default |
Description |
input_paths |
array |
Yes |
— |
Input point cloud file paths |
Parameters |
object |
Yes |
— |
Contour generation parameters |
Parameters fields
| Field |
Type |
Required |
Default |
Description |
TerrainFromClass |
array |
Yes |
[2] |
Point classification codes used for contour generation. Example: [2, 5]. |
Base |
number |
No |
0 |
Base elevation for contour generation |
TriangleLength |
number |
No |
30 |
Triangle length for TIN construction |
IsDeleteMinimumArea |
boolean |
No |
True |
Whether to delete minimum area polygons |
IsDeleteMinimumLength |
boolean |
No |
True |
Whether to delete minimum length polylines |
MinimumArea |
number |
No |
10 |
Minimum area threshold |
MinumumLength |
number |
No |
5 |
Minimum length threshold |
IsMeanSmooth |
boolean |
No |
True |
Whether to apply mean smoothing |
IsBezierSmooth |
boolean |
No |
True |
Whether to apply Bezier smoothing |
bezierSmoothPara |
number |
No |
155 |
Bezier smoothing angle parameter |
meanSmoothPara |
integer |
No |
5 |
Mean smoothing iterations |
scaleIndex |
integer |
No |
10 |
Map scale index (e.g. 10=e_10000) |
minorSpacing |
number |
No |
2.5 |
Minor contour interval |
basicSpacing |
number |
No |
5 |
Basic contour interval |
majorSpacing |
number |
No |
25 |
Major contour interval |
isGenerMinor |
boolean |
No |
True |
Whether to generate minor contours |
isGenerBasic |
boolean |
No |
False |
Whether to generate basic contours |
isGenerMajor |
boolean |
No |
False |
Whether to generate major contours |
MajorLineWidth |
integer |
No |
30 |
Major contour line width |
basicLineWidth |
integer |
No |
15 |
Basic contour line width |
minorLineWidth |
integer |
No |
15 |
Minor contour line width |
isGenerHeightSpreadPoint |
boolean |
No |
False |
Whether to generate height spread points |
heightSpreadRadius |
number |
No |
15 |
Height spread point sampling radius |
autoLabelContour |
boolean |
No |
True |
Whether to auto-label contour elevations |
labelInterval |
number |
No |
35 |
Label interval along contour lines |
labelAccuracy |
integer |
No |
2 |
Label decimal accuracy |
fileType |
integer |
No |
0 |
Output file type: 0=SHP, 1=DXF |
contour25D |
boolean |
No |
False |
Whether to generate 2.5D contours |
Example
from gvscript import mls
params = mls.road_terrain.pointcloud_to_contour_parameters()
params.TerrainFromClass = [2]
result = mls.road_terrain.pointcloud_to_contour(
Parameters=params,
input_paths=['D:/data/input.LiData'],
)
print(result.ok, result.output, result.message)
pointcloud_to_dsm
Based on point cloud, generate DSM in tif format.
- Exact tool ID:
RoadTerrain_PointCloud_To_DSM
- Recommended call:
mls.road_terrain.pointcloud_to_dsm(...)
- Alias:
PointCloud_To_DSM
- Required parameters:
input_paths, Parameters
Parameters
| Parameter |
Type |
Required |
Default |
Description |
input_paths |
array |
Yes |
— |
Input point cloud file paths. Put all point cloud paths here. |
Parameters |
object |
Yes |
— |
DSM generation parameters. Keep all algorithm parameters inside this object. |
Parameters fields
| Field |
Type |
Required |
Default |
Description |
fromClass |
array |
No |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255] |
Point classification codes to use. Defaults to all classes. |
type |
integer |
No |
1 |
None |
resultType |
integer |
No |
1 |
None |
exportMode |
integer |
No |
0 |
Output mode. 0 = By Resolution, 1 = By Scale. |
cellSize |
number |
Yes |
2.0 |
Output raster resolution. When exportMode is 1, derive this from tileScale: 500->0.05, 1000->0.1, 2000->0.2, 5000->0.5. |
tileScale |
integer |
No |
1000 |
Tile scale used when exportMode is 1. |
tileBuffer |
number |
No |
10.0 |
Tile buffer used when exportMode is 1. |
fillHole |
boolean |
No |
True |
Whether to automatically fill small gaps. |
asSingle |
boolean |
No |
False |
Merge all point clouds into a single raster when exportMode is 0. |
outPutDir |
string |
Yes |
— |
Output directory for generated raster files. |
Example
from gvscript import mls
params = mls.road_terrain.pointcloud_to_dsm_parameters()
params.fromClass = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255]
result = mls.road_terrain.pointcloud_to_dsm(
Parameters=params,
input_paths=['D:/data/input.LiData'],
)
print(result.ok, result.output, result.message)
tin_to_dem
Based on existing TIN, generate DEM in tif format.
- Exact tool ID:
RoadTerrain_TIN_To_DEM
- Recommended call:
mls.road_terrain.tin_to_dem(...)
- Alias:
TIN_To_DEM
- Required parameters:
input_paths, Parameters
Parameters
| Parameter |
Type |
Required |
Default |
Description |
input_paths |
array |
Yes |
— |
Input TIN file paths. |
Parameters |
object |
Yes |
— |
TIN to DEM generation parameters |
Parameters fields
| Field |
Type |
Required |
Default |
Description |
cellSize |
number |
Yes |
2.0 |
Output raster resolution. |
outPutDir |
string |
Yes |
— |
Output directory for generated DEM raster files. |
Example
from gvscript import mls
params = mls.road_terrain.tin_to_dem_parameters()
params.cellSize = 2.0
result = mls.road_terrain.tin_to_dem(
Parameters=params,
input_paths=['D:/data/input.LiData'],
)
print(result.ok, result.output, result.message)