ign-pdal-tools 1.7.1__py3-none-any.whl → 1.7.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ign-pdal-tools
3
- Version: 1.7.1
3
+ Version: 1.7.3
4
4
  Summary: Library for common LAS files manipulation with PDAL
5
5
  Author-email: Guillaume Liegard <guillaume.liegard@ign.fr>
6
6
  Description-Content-Type: text/markdown
@@ -50,6 +50,18 @@ filename = ...
50
50
  las_infos.las_info_metadata(filename)
51
51
  ```
52
52
 
53
+ ## Point cloud infos
54
+
55
+ Misc tools to get information on a point cloud (numpy array). Eg. get expected origin of a point cloud based on a square tiling:
56
+
57
+ ```python
58
+ from pdaltools import pcd_infos
59
+
60
+ points = ...
61
+ pcd_infos.get_pointcloud_origin_from_tile_width(points, tile_width=1000)
62
+ ```
63
+
64
+
53
65
  ## Stitching
54
66
 
55
67
  * [las_clip.py](pdaltools/las_clip.py): crop a LAS file using 2d bounding box
@@ -1,15 +1,16 @@
1
- pdaltools/_version.py,sha256=xwBg7KNoeyzwyonEgM9Mm-9CRDfrRb3V1tY-iPeL3Os,74
1
+ pdaltools/_version.py,sha256=CIj6_M9SXht6CUH70oDuQQl4_AP2fggn-8tFZbGL0AY,74
2
2
  pdaltools/color.py,sha256=7U-SThIKqrfE1xXXnFqpbIhmZEqna29nRiyLW8l8Y1c,8075
3
3
  pdaltools/las_add_buffer.py,sha256=sBpTywlfsHHS8KuCUa-eydB2hylshEvjrMQt5TrqXb8,11275
4
4
  pdaltools/las_clip.py,sha256=GvEOYu8RXV68e35kU8i42GwSkbo4P9TvmS6rkrdPmFM,1034
5
5
  pdaltools/las_info.py,sha256=RE-UBdEUXqKvSrMV3mOlvE_16mhum7bw-p-ERu5bGOc,6979
6
6
  pdaltools/las_merge.py,sha256=tcFVueV9X9nNEaoAl5zCduY5DETlBg63MAgP2SuKiNo,4121
7
7
  pdaltools/las_remove_dimensions.py,sha256=0zhv9LBvlL69TLmXTJlRQcUBOaBmCRZEQU2Qadx27aM,1805
8
+ pdaltools/pcd_info.py,sha256=d7ukCEdOFBQqaFp3HYM2MNbKDl1hdxUVHI9vSu9jN-M,1897
8
9
  pdaltools/replace_attribute_in_las.py,sha256=po1F-fi8s7iilqKWaryW4JRbsmdMOUe0yGvG3AEKxtk,4771
9
- pdaltools/standardize_format.py,sha256=KM_jC_aC9yLD5rrSUGgTwfyakbh86FXsAI-y8gokF4M,2883
10
+ pdaltools/standardize_format.py,sha256=lUzrjWY22WfxT_2zLtxuXbmWgiAvjy9o7fBXWsAZmDg,3240
10
11
  pdaltools/unlock_file.py,sha256=pIThdWMNkTph0xgJVVRaM1o9aUMQhM6804PscScB3JI,1963
11
- ign_pdal_tools-1.7.1.dist-info/LICENSE.md,sha256=iVzCFZTUXeiqP8bP474iuWZiWO_kDCD4SPh1Wiw125Y,1120
12
- ign_pdal_tools-1.7.1.dist-info/METADATA,sha256=4xHIuVdU1-CJuSZZZhUIWUGg1rLzTtq9JV_VRsvrBPQ,4825
13
- ign_pdal_tools-1.7.1.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
14
- ign_pdal_tools-1.7.1.dist-info/top_level.txt,sha256=KvGW0ZzqQbhCKzB5_Tp_buWMZyIgiO2M2krWF_ecOZc,10
15
- ign_pdal_tools-1.7.1.dist-info/RECORD,,
12
+ ign_pdal_tools-1.7.3.dist-info/LICENSE.md,sha256=iVzCFZTUXeiqP8bP474iuWZiWO_kDCD4SPh1Wiw125Y,1120
13
+ ign_pdal_tools-1.7.3.dist-info/METADATA,sha256=PfhYtt73bGGZxehInuRGdzwfhfW_1UxMO7K3CrPlDL0,5112
14
+ ign_pdal_tools-1.7.3.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
15
+ ign_pdal_tools-1.7.3.dist-info/top_level.txt,sha256=KvGW0ZzqQbhCKzB5_Tp_buWMZyIgiO2M2krWF_ecOZc,10
16
+ ign_pdal_tools-1.7.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.3.0)
2
+ Generator: setuptools (74.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
pdaltools/_version.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "1.7.1"
1
+ __version__ = "1.7.3"
2
2
 
3
3
 
4
4
  if __name__ == "__main__":
pdaltools/pcd_info.py ADDED
@@ -0,0 +1,46 @@
1
+ """Tools to get information from a point cloud (points as a numpy array)"""
2
+
3
+ from typing import Tuple
4
+
5
+ import numpy as np
6
+
7
+
8
+ def get_pointcloud_origin_from_tile_width(
9
+ points: np.ndarray, tile_width: int = 1000, buffer_size: float = 0
10
+ ) -> Tuple[int, int]:
11
+ """Get point cloud theoretical origin (xmin, ymax) for a data that originates from a square tesselation/tiling
12
+ using the tesselation tile width only.
13
+
14
+ Edge values are supposed to be included in the tile
15
+
16
+
17
+ Args:
18
+ points (np.ndarray): numpy array with the tile points
19
+ tile_width (int, optional): Edge size of the square used for tiling. Defaults to 1000.
20
+ buffer_size (float, optional): Optional buffer around the tile. Defaults to 0.
21
+
22
+ Raises:
23
+ ValueError: Raise an error when the bounding box of the tile is not included in a tile
24
+
25
+ Returns:
26
+ Tuple[int, int]: (origin_x, origin_y) origin coordinates
27
+ """
28
+ # Extract coordinates xmin, xmax, ymin and ymax of the original tile without buffer
29
+ x_min, y_min = np.min(points[:, :2], axis=0) + buffer_size
30
+ x_max, y_max = np.max(points[:, :2], axis=0) - buffer_size
31
+
32
+ # Calculate the tiles to which x, y bounds belong
33
+ tile_x_min = np.floor(x_min / tile_width)
34
+ tile_x_max = np.floor(x_max / tile_width) if x_max % tile_width != 0 else np.floor(x_max / tile_width) - 1
35
+ tile_y_min = np.ceil(y_min / tile_width) if y_min % tile_width != 0 else np.floor(y_min / tile_width) + 1
36
+ tile_y_max = np.ceil(y_max / tile_width)
37
+
38
+ if not (tile_x_max - tile_x_min) and not (tile_y_max - tile_y_min):
39
+ origin_x = tile_x_min * tile_width
40
+ origin_y = tile_y_max * tile_width
41
+ return origin_x, origin_y
42
+ else:
43
+ raise ValueError(
44
+ f"Min values (x={x_min} and y={y_min}) do not belong to the same theoretical tile as"
45
+ f"max values (x={x_max} and y={y_max})."
46
+ )
@@ -7,6 +7,7 @@
7
7
  - precision
8
8
  - no extra-dims
9
9
  """
10
+
10
11
  import argparse
11
12
  import os
12
13
  import subprocess as sp
@@ -42,6 +43,14 @@ def parse_args():
42
43
  "--record_format", choices=[6, 8], type=int, help="Record format: 6 (no color) or 8 (4 color channels)"
43
44
  )
44
45
  parser.add_argument("--projection", default="EPSG:2154", type=str, help="Projection, eg. EPSG:2154")
46
+ parser.add_argument(
47
+ "--extra_dims",
48
+ default=[],
49
+ nargs="*",
50
+ type=str,
51
+ help="List of extra dims to keep in the output (default=[], use 'all' to keep all extra dims), "
52
+ "extra_dims must be specified with their type (see pdal.writers.las documentation, eg 'dim1=double')",
53
+ )
45
54
 
46
55
  return parser.parse_args()
47
56
 
@@ -86,5 +95,5 @@ def standardize(input_file: str, output_file: str, params_from_parser: Dict) ->
86
95
 
87
96
  if __name__ == "__main__":
88
97
  args = parse_args()
89
- params_from_parser = dict(dataformat_id=args.record_format, a_srs=args.projection)
98
+ params_from_parser = dict(dataformat_id=args.record_format, a_srs=args.projection, extra_dims=args.extra_dims)
90
99
  standardize(args.input_file, args.output_file, params_from_parser)