Skip to content

Commit 98aa715

Browse files
authored
Merge pull request #158 from IGNF/dev
dev -> master pour version 1.15.3
2 parents 9a81f10 + 4974f22 commit 98aa715

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.15.3
2+
- [fix] replace_area_plointcloud: handle DSM without 'nodata' value
3+
14
# 1.15.2
25
- [fix] add_points_to_pointcloud: remove duplicate points added from geometry before adding in the result las
36
- [fix] replace_area_plointcloud: from DSM: ground_area (vector) is replaced by ground_mask (raster)

pdaltools/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.15.2"
1+
__version__ = "1.15.3"
22

33

44
if __name__ == "__main__":

pdaltools/replace_area_in_pointcloud.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,29 @@ def get_writer_params(input_file):
102102

103103

104104
def pipeline_read_from_cloud(filename):
105+
print("source cloud: ", filename)
105106
pipeline_source = pdal.Pipeline()
106107
pipeline_source |= pdal.Reader.las(filename=filename)
107108
return pipeline_source
108109

109110

110111
def pipeline_read_from_DSM(dsm, ground_mask, classification):
112+
print("DSM: ", dsm)
113+
print("ground_mask: ", ground_mask)
114+
print("classification: ", classification)
115+
111116
# get nodata value
112117
ds = gdal.Open(dsm)
113118
band = ds.GetRasterBand(1)
114119
nodata_value = band.GetNoDataValue()
120+
print("DSM: nodata:", nodata_value)
115121
ds.Close()
116122

117123
pipeline = pdal.Pipeline()
118124
pipeline |= pdal.Reader.gdal(filename=dsm, header="Z")
119-
pipeline |= pdal.Filter.expression(expression=f"Z != {nodata_value}")
125+
126+
if nodata_value is not None: # nodata_value may be None and cause bugs
127+
pipeline |= pdal.Filter.expression(expression=f"Z != {nodata_value}")
120128

121129
pipeline |= pdal.Filter.ferry(dimensions="=> ground")
122130
pipeline |= pdal.Filter.assign(assignment="ground[:]=-1")
@@ -134,6 +142,11 @@ def pipeline_read_from_DSM(dsm, ground_mask, classification):
134142
def replace_area(
135143
target_cloud, pipeline_source, replacement_area, output_cloud, source_pdal_filter="", target_pdal_filter=""
136144
):
145+
print("target cloud: ", target_cloud)
146+
print("replacement area: ", replacement_area)
147+
print("output cloud: ", output_cloud)
148+
print("source pdal filter: ", source_pdal_filter)
149+
print("target pdal filter: ", target_pdal_filter)
137150
crops = []
138151
# pipeline to read target_cloud and remove points inside the polygon
139152
pipeline_target = pdal.Pipeline()

0 commit comments

Comments
 (0)