-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdal_deli_1_1_4.py
48 lines (43 loc) · 1.31 KB
/
pdal_deli_1_1_4.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
import pdal
def create_pipeline(input_filename, output_filename):
pipeline_json = """
{
"pipeline": [
{
"type": "readers.las",
"filename": "%s"
},
{
"type": "filters.outlier",
"method": "statistical",
"mean_k": 8,
"multiplier": 3
},
{
"type": "filters.assign",
"value": [
"Classification = 0 WHERE Classification == 7"
]
},
{
"type": "filters.decimation",
"step": 10
},
{
"type": "writers.las",
"filename": "%s"
}
]
}
""" % (input_filename.replace("\\", "/"), output_filename.replace("\\", "/"))
return pipeline_json
def run_pipeline(pipeline_json):
pipeline = pdal.Pipeline(pipeline_json)
pipeline.execute()
# Input and output filenames
input_filename = r'path\to\pdalpy\data\classified_points_final.las'
output_filename = r'path\to\pdalpy\data\thinned_points.laz'
# Create the pipeline
pipeline_json = create_pipeline(input_filename, output_filename)
# Run the pipeline
run_pipeline(pipeline_json)