-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdal_merge.py
51 lines (46 loc) · 1.52 KB
/
pdal_merge.py
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
# This file is meant to merge multiple las files and handle invalid ReturnNumber/NumberOfReturns into a single (las/laz) file
# expected export format: laz/las file
# Version 1.0.0:
# changes : initial script
# Author: Walid Ghariani
import sys
import pdal
import json
def merge_pts(mergedfile):
''' Point clouds proccessing pipeline to create a segmented
Args:
mergedfile (str): output laz/las file for the merged point clouds
'''
pipe_merge =\
{
"pipeline":[
"input_lidar/laser_1_2021-02-25-10-13-37_344_RemoveOutliers.las",
"input_lidar/laser_1_2021-02-25-10-13-37_392_RemoveOutliers.las",
"input_lidar/laser_1_2021-02-25-10-13-37_608_RemoveOutliers.las",
"input_lidar/laser_1_2021-02-25-10-13-37_704_RemoveOutliers.las",
{
"type": "filters.merge"
},
{
"type":"filters.assign","assignment":"NumberOfReturns[:]=1"
},
{
"type":"filters.assign","assignment":"ReturnNumber[:]=1"
},
{
"type":"writers.las",
"filename":"./input_lidar/"+ mergedfile
}
]
}
# Generate DTM
print("-----> Merging las/laz files : In progress")
pipelineMerge = pdal.Pipeline(json.dumps(pipe_merge))
pipelineMerge.validate()
pipelineMerge.execute()
print("-----> Merging las/laz files: Done")
def main() :
mergedfile = sys.argv[1]
merge_pts(mergedfile)
if __name__ == "__main__":
main()