ign-pdal-tools 1.10.0__py3-none-any.whl → 1.11.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ign_pdal_tools-1.10.0.dist-info → ign_pdal_tools-1.11.1.dist-info}/METADATA +1 -1
- {ign_pdal_tools-1.10.0.dist-info → ign_pdal_tools-1.11.1.dist-info}/RECORD +8 -8
- {ign_pdal_tools-1.10.0.dist-info → ign_pdal_tools-1.11.1.dist-info}/WHEEL +1 -1
- pdaltools/_version.py +1 -1
- pdaltools/las_rename_dimension.py +11 -11
- pdaltools/standardize_format.py +43 -13
- {ign_pdal_tools-1.10.0.dist-info → ign_pdal_tools-1.11.1.dist-info}/licenses/LICENSE.md +0 -0
- {ign_pdal_tools-1.10.0.dist-info → ign_pdal_tools-1.11.1.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
ign_pdal_tools-1.
|
|
2
|
-
pdaltools/_version.py,sha256=
|
|
1
|
+
ign_pdal_tools-1.11.1.dist-info/licenses/LICENSE.md,sha256=iVzCFZTUXeiqP8bP474iuWZiWO_kDCD4SPh1Wiw125Y,1120
|
|
2
|
+
pdaltools/_version.py,sha256=ePCDD63wucRpBvp1zzN9uerMLecQK4e65Z3lJKH3_4M,75
|
|
3
3
|
pdaltools/add_points_in_pointcloud.py,sha256=13xl8tnoaW6FsRHBPa77-c6Olw8uUw2KBUGoz8JcbBg,12675
|
|
4
4
|
pdaltools/color.py,sha256=vJgpb8dOvT5rnq5NdVOaMdGc_pKL3damLy4HwGvigJQ,14472
|
|
5
5
|
pdaltools/las_add_buffer.py,sha256=rnFExAfi0KqlQpL4hDMh2aC08AcYdSHSB6WPG5RyFIc,11274
|
|
@@ -7,12 +7,12 @@ pdaltools/las_clip.py,sha256=GvEOYu8RXV68e35kU8i42GwSkbo4P9TvmS6rkrdPmFM,1034
|
|
|
7
7
|
pdaltools/las_info.py,sha256=lMKxKzsViptDENI1wOlANG4qOvdc19ixyasYKD-N1ck,9512
|
|
8
8
|
pdaltools/las_merge.py,sha256=tcFVueV9X9nNEaoAl5zCduY5DETlBg63MAgP2SuKiNo,4121
|
|
9
9
|
pdaltools/las_remove_dimensions.py,sha256=f8imGhN6LNTuQ1GMJQRzIIV3Wab_oRPOyEnKi1CgfiM,2318
|
|
10
|
-
pdaltools/las_rename_dimension.py,sha256=
|
|
10
|
+
pdaltools/las_rename_dimension.py,sha256=zXEKHyx1uQ3U0oZYo_BTnqbTHGSq5TIZHqZn_EPqNKQ,2576
|
|
11
11
|
pdaltools/pcd_info.py,sha256=NIAH5KGikVDQLlbCcw9FuaPqe20UZvRfkHsDZd5kmZA,3210
|
|
12
12
|
pdaltools/replace_attribute_in_las.py,sha256=po1F-fi8s7iilqKWaryW4JRbsmdMOUe0yGvG3AEKxtk,4771
|
|
13
|
-
pdaltools/standardize_format.py,sha256=
|
|
13
|
+
pdaltools/standardize_format.py,sha256=Z09yhY_dRaX0uNO0K_Ml5ZD3XpVDv4Q2gIyZHXaplAQ,4849
|
|
14
14
|
pdaltools/unlock_file.py,sha256=G2odk0cpp_X9r49Y90oK88v3qlihaMfg6acwmWqblik,1958
|
|
15
|
-
ign_pdal_tools-1.
|
|
16
|
-
ign_pdal_tools-1.
|
|
17
|
-
ign_pdal_tools-1.
|
|
18
|
-
ign_pdal_tools-1.
|
|
15
|
+
ign_pdal_tools-1.11.1.dist-info/METADATA,sha256=JnMi78wrNuEEwzqfP9ql8AcyBVRZJmazi-fmHUHuKeA,5778
|
|
16
|
+
ign_pdal_tools-1.11.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
ign_pdal_tools-1.11.1.dist-info/top_level.txt,sha256=KvGW0ZzqQbhCKzB5_Tp_buWMZyIgiO2M2krWF_ecOZc,10
|
|
18
|
+
ign_pdal_tools-1.11.1.dist-info/RECORD,,
|
pdaltools/_version.py
CHANGED
|
@@ -13,20 +13,20 @@ from pdaltools.las_remove_dimensions import remove_dimensions_from_points
|
|
|
13
13
|
|
|
14
14
|
def rename_dimension(input_file: str, output_file: str, old_dims: list[str], new_dims: list[str]):
|
|
15
15
|
"""
|
|
16
|
-
Rename one or multiple dimensions in a LAS file using PDAL.
|
|
16
|
+
Rename one or multiple dimensions in a LAS file using PDAL.
|
|
17
17
|
|
|
18
|
-
Args:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"""
|
|
18
|
+
Args:
|
|
19
|
+
input_file: Path to the input LAS file
|
|
20
|
+
output_file: Path to save the output LAS file
|
|
21
|
+
old_dims: List of names of dimensions to rename
|
|
22
|
+
new_dims: List of new names for the dimensions
|
|
23
|
+
"""
|
|
24
24
|
|
|
25
25
|
# Validate dimensions
|
|
26
26
|
if len(old_dims) != len(new_dims):
|
|
27
27
|
raise ValueError("Number of old dimensions must match number of new dimensions")
|
|
28
28
|
|
|
29
|
-
mandatory_dimensions = [
|
|
29
|
+
mandatory_dimensions = ["X", "Y", "Z", "x", "y", "z"]
|
|
30
30
|
for dim in new_dims:
|
|
31
31
|
if dim in mandatory_dimensions:
|
|
32
32
|
raise ValueError(f"New dimension {dim} cannot be a mandatory dimension (X,Y,Z,x,y,z)")
|
|
@@ -60,18 +60,18 @@ def main():
|
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
args = parser.parse_args()
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
# Validate input file
|
|
65
65
|
input_path = Path(args.input_file)
|
|
66
66
|
if not input_path.exists():
|
|
67
67
|
print(f"Error: Input file {args.input_file} does not exist", file=sys.stderr)
|
|
68
68
|
sys.exit(1)
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
# Validate output file
|
|
71
71
|
output_path = Path(args.output_file)
|
|
72
72
|
if output_path.exists():
|
|
73
73
|
print(f"Warning: Output file {args.output_file} already exists. It will be overwritten.")
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
rename_dimension(args.input_file, args.output_file, args.old_dims, args.new_dims)
|
|
76
76
|
|
|
77
77
|
|
pdaltools/standardize_format.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""Re-write las file with expected format:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
- laz version
|
|
3
|
+
- [TODO] nomenclature ???
|
|
4
|
+
- record format
|
|
5
|
+
- global encoding
|
|
6
|
+
- projection
|
|
7
|
+
- precision
|
|
8
|
+
- no extra-dims
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
import argparse
|
|
@@ -18,6 +18,7 @@ from typing import Dict, List
|
|
|
18
18
|
import pdal
|
|
19
19
|
|
|
20
20
|
from pdaltools.unlock_file import copy_and_hack_decorator
|
|
21
|
+
from pdaltools.las_rename_dimension import rename_dimension
|
|
21
22
|
|
|
22
23
|
# Standard parameters to pass to the pdal writer
|
|
23
24
|
STANDARD_PARAMETERS = dict(
|
|
@@ -60,6 +61,13 @@ def parse_args():
|
|
|
60
61
|
help="List of extra dims to keep in the output (default=[], use 'all' to keep all extra dims), "
|
|
61
62
|
"extra_dims must be specified with their type (see pdal.writers.las documentation, eg 'dim1=double')",
|
|
62
63
|
)
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
"--rename_dims",
|
|
66
|
+
default=[],
|
|
67
|
+
nargs="*",
|
|
68
|
+
type=str,
|
|
69
|
+
help="Rename dimensions in pairs: --rename_dims old_name1 new_name1 old_name2 new_name2 ...",
|
|
70
|
+
)
|
|
63
71
|
return parser.parse_args()
|
|
64
72
|
|
|
65
73
|
|
|
@@ -73,11 +81,27 @@ def get_writer_parameters(new_parameters: Dict) -> Dict:
|
|
|
73
81
|
|
|
74
82
|
|
|
75
83
|
def rewrite_with_pdal(
|
|
76
|
-
input_file: str, output_file: str, params_from_parser: Dict, classes_to_remove: List = []
|
|
84
|
+
input_file: str, output_file: str, params_from_parser: Dict, classes_to_remove: List = [], rename_dims: List = []
|
|
77
85
|
) -> None:
|
|
78
86
|
params = get_writer_parameters(params_from_parser)
|
|
87
|
+
|
|
88
|
+
# Create temporary file for dimension renaming if needed
|
|
89
|
+
if rename_dims:
|
|
90
|
+
with tempfile.NamedTemporaryFile(suffix=".laz", delete=False) as tmp_file:
|
|
91
|
+
tmp_file_name = tmp_file.name
|
|
92
|
+
|
|
93
|
+
# Rename dimensions
|
|
94
|
+
old_dims = rename_dims[::2]
|
|
95
|
+
new_dims = rename_dims[1::2]
|
|
96
|
+
rename_dimension(input_file, tmp_file_name, old_dims, new_dims)
|
|
97
|
+
|
|
98
|
+
# Use renamed file as input
|
|
99
|
+
input_file = tmp_file_name
|
|
100
|
+
else:
|
|
101
|
+
tmp_file_name = input_file
|
|
102
|
+
|
|
79
103
|
pipeline = pdal.Pipeline()
|
|
80
|
-
pipeline |= pdal.Reader.las(
|
|
104
|
+
pipeline |= pdal.Reader.las(tmp_file_name)
|
|
81
105
|
if classes_to_remove:
|
|
82
106
|
expression = "&&".join([f"Classification != {c}" for c in classes_to_remove])
|
|
83
107
|
pipeline |= pdal.Filter.expression(expression=expression)
|
|
@@ -102,18 +126,24 @@ def exec_las2las(input_file: str, output_file: str):
|
|
|
102
126
|
|
|
103
127
|
|
|
104
128
|
@copy_and_hack_decorator
|
|
105
|
-
def standardize(
|
|
129
|
+
def standardize(
|
|
130
|
+
input_file: str, output_file: str, params_from_parser: Dict, class_points_removed: [], rename_dims: []
|
|
131
|
+
) -> None:
|
|
106
132
|
filename = os.path.basename(output_file)
|
|
107
133
|
with tempfile.NamedTemporaryFile(suffix=filename) as tmp:
|
|
108
|
-
rewrite_with_pdal(input_file, tmp.name, params_from_parser, class_points_removed)
|
|
134
|
+
rewrite_with_pdal(input_file, tmp.name, params_from_parser, class_points_removed, rename_dims)
|
|
109
135
|
exec_las2las(tmp.name, output_file)
|
|
110
136
|
|
|
111
137
|
|
|
112
|
-
|
|
138
|
+
def main():
|
|
113
139
|
args = parse_args()
|
|
114
140
|
params_from_parser = dict(
|
|
115
141
|
dataformat_id=args.record_format,
|
|
116
142
|
a_srs=args.projection,
|
|
117
143
|
extra_dims=args.extra_dims,
|
|
118
144
|
)
|
|
119
|
-
standardize(args.input_file, args.output_file, params_from_parser, args.class_points_removed)
|
|
145
|
+
standardize(args.input_file, args.output_file, params_from_parser, args.class_points_removed, args.rename_dims)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if __name__ == "__main__":
|
|
149
|
+
main()
|
|
File without changes
|
|
File without changes
|