Skip to content

Commit

Permalink
Update pdal.writers calls to forward formats by default
Browse files Browse the repository at this point in the history
  • Loading branch information
leavauchier committed Jan 24, 2024
1 parent b223715 commit 35a8249
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# dev
- fix add_buffer: propagate header infos from input to the output
- update pdal.Writer params to make sure input format is forwarded except for the specified parameters

# 1.5.0
- switch colorisation source from Geoportail to Geoplateforme
Expand Down
2 changes: 1 addition & 1 deletion pdaltools/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def color(
pipeline |= pdal.Filter.colorization(raster=tmp_ortho_irc.name, dimensions="Infrared:1:256.0")

pipeline |= pdal.Writer.las(
filename=output_file, extra_dims=writer_extra_dims, minor_version="4", dataformat_id="8"
filename=output_file, extra_dims=writer_extra_dims, minor_version="4", dataformat_id="8", forward="all"
)

print("Traitement du nuage de point")
Expand Down
2 changes: 1 addition & 1 deletion pdaltools/las_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def las_crop(input_file: str, output_file: str, bounds, spatial_ref: str = "EPSG
"pipeline": [
{"type": "readers.las", "filename": input_file, "override_srs": spatial_ref, "nosrs": True},
{"type": "filters.crop", "bounds": str(bounds)},
{"type": "writers.las", "a_srs": spatial_ref, "filename": output_file},
{"type": "writers.las", "a_srs": spatial_ref, "filename": output_file, "forward": "all"},
]
}
# Create json
Expand Down
15 changes: 7 additions & 8 deletions pdaltools/las_merge.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import logging
import os

Expand Down Expand Up @@ -97,14 +96,14 @@ def las_merge(las_dir, input_file, merge_file, tile_width=1000, tile_coord_scale
1000 * 1m (with 1m being the reference)
"""
# List files to merge
Listfiles = create_list(las_dir, input_file, tile_width, tile_coord_scale)
if len(Listfiles) > 0:
files = create_list(las_dir, input_file, tile_width, tile_coord_scale)
if len(files) > 0:
# Merge
information = {}
information = {"pipeline": Listfiles + [merge_file]}
merge = json.dumps(information, sort_keys=True, indent=4)
logging.info(merge)
pipeline = pdal.Pipeline(merge)
pipeline = pdal.Pipeline()
for f in files:
pipeline |= pdal.Reader.las(filename=f)
pipeline |= pdal.Filter.merge()
pipeline |= pdal.Writer.las(filename=merge_file, forward="all")
pipeline.execute()
else:
raise ValueError("List of valid tiles is empty : stop processing")
2 changes: 1 addition & 1 deletion pdaltools/replace_attribute_in_las.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def replace_values(
pipeline |= pdal.Filter.assign(value=assignment_list)
# the temp_attribute dimension should not be written as long as the writer has no "extra_dims"
# parameter
pipeline |= pdal.Writer(filename=output_file, **writer_parameters)
pipeline |= pdal.Writer(filename=output_file, forward="all", **writer_parameters)

pipeline.execute()

Expand Down
2 changes: 1 addition & 1 deletion pdaltools/standardize_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def rewrite_with_pdal(input_file: str, output_file: str, params_from_parser: Dic
# Update parameters with command line values
params = get_writer_parameters(params_from_parser)
pipeline = pdal.Reader.las(input_file)
pipeline |= pdal.Writer(filename=output_file, **params)
pipeline |= pdal.Writer(filename=output_file, forward="all", **params)
pipeline.execute()


Expand Down

0 comments on commit 35a8249

Please sign in to comment.