-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdal_deli_1_1_3.py
55 lines (50 loc) · 1.58 KB
/
pdal_deli_1_1_3.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
52
53
54
55
import pdal
def create_pipeline(input_filename, output_filename):
pipeline_json = """
{
"pipeline": [
{
"type": "readers.las",
"filename": "%s"
},
{
"type": "filters.assign",
"assignment": "Classification[:]=0"
},
{
"type": "filters.smrf",
"scalar": 1.2,
"slope": 0.2,
"threshold": 0.45,
"window": 16,
"cell": 1.0
},
{
"type": "filters.hag_nn",
"count": 10
},
{
"type": "filters.assign",
"value": [
"Classification = 2 WHERE HeightAboveGround <= 1",
"Classification = 5 WHERE HeightAboveGround > 1"
]
},
{
"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\NEONDSSampleLiDARPointCloud.las'
output_filename = r'path\to\pdalpy\data\classified_points_final_hag.laz'
# Create the pipeline
pipeline_json = create_pipeline(input_filename, output_filename)
# Run the pipeline
run_pipeline(pipeline_json)