ign-borea 0.1.5__py3-none-any.whl → 0.2.2__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.
- borea/datastruct/dtm.py +2 -2
- borea/datastruct/shot.py +9 -3
- borea/datastruct/workdata.py +19 -12
- borea/format/conl.py +1 -5
- borea/format/rpc.py +12 -4
- borea/geodesy/local_euclidean_proj.py +9 -9
- borea/geodesy/proj_engine.py +10 -7
- borea/geodesy/transform_geodesy.py +171 -45
- borea/process/p_add_data/p_gen_param.py +3 -14
- borea/process/p_add_data/p_proj.py +57 -0
- borea/process/p_add_data/p_unit_shot.py +3 -3
- borea/process/p_format/p_write_opk.py +5 -5
- borea/process/p_func/p_spaceresection.py +2 -2
- borea/process/p_func/p_tf_proj_pt.py +50 -0
- borea/reader/orientation/manage_reader.py +2 -2
- borea/reader/orientation/reader_opk.py +3 -3
- borea/reader/reader_camera.py +3 -2
- borea/reader/reader_point.py +7 -7
- borea/stat/statistics.py +2 -2
- borea/transform_world_image/transform_shot/conversion_coor_shot.py +4 -4
- borea/transform_world_image/transform_shot/image_world_shot.py +1 -1
- borea/transform_world_image/transform_shot/world_image_shot.py +1 -1
- borea/transform_world_image/transform_worksite/image_world_least_square.py +1 -1
- borea/transform_world_image/transform_worksite/space_resection.py +2 -2
- borea/utils/check/check_path.py +26 -0
- borea/utils/solver/__init__.py +0 -0
- borea/utils/solver/solver.py +18 -0
- borea/worksite/worksite.py +10 -5
- borea/writer/writer_con.py +10 -3
- borea/writer/writer_df_to_txt.py +2 -2
- borea/writer/writer_opk.py +3 -3
- borea/writer/writer_rpc.py +7 -4
- borea_tools/spaceresection_opk.py +2 -2
- borea_tools/transform_proj_points.py +30 -0
- {ign_borea-0.1.5.dist-info → ign_borea-0.2.2.dist-info}/METADATA +2 -3
- {ign_borea-0.1.5.dist-info → ign_borea-0.2.2.dist-info}/RECORD +40 -34
- {ign_borea-0.1.5.dist-info → ign_borea-0.2.2.dist-info}/WHEEL +1 -1
- {ign_borea-0.1.5.dist-info → ign_borea-0.2.2.dist-info}/entry_points.txt +1 -0
- {ign_borea-0.1.5.dist-info → ign_borea-0.2.2.dist-info}/LICENSE +0 -0
- {ign_borea-0.1.5.dist-info → ign_borea-0.2.2.dist-info}/top_level.txt +0 -0
|
@@ -45,8 +45,8 @@ def process_args_write_opk(args: argparse, work: Worksite) -> None:
|
|
|
45
45
|
args (argparse): Arg to apply on worksite (data).
|
|
46
46
|
work (Worksite): Data.
|
|
47
47
|
"""
|
|
48
|
-
if args.
|
|
49
|
-
args.
|
|
48
|
+
if args.ob:
|
|
49
|
+
args.ob = args.ob.lower()
|
|
50
50
|
|
|
51
51
|
if args.output_header:
|
|
52
52
|
args.output_header = list(args.output_header.upper())
|
|
@@ -54,10 +54,10 @@ def process_args_write_opk(args: argparse, work: Worksite) -> None:
|
|
|
54
54
|
# Writing data
|
|
55
55
|
print("Writing OPK.")
|
|
56
56
|
if args.namereturn is not None:
|
|
57
|
-
args_writing = {"order_axe": args.
|
|
57
|
+
args_writing = {"order_axe": args.ob,
|
|
58
58
|
"header": args.output_header,
|
|
59
|
-
"unit_angle": args.
|
|
60
|
-
"linear_alteration": args.
|
|
59
|
+
"unit_angle": args.ou,
|
|
60
|
+
"linear_alteration": args.oa}
|
|
61
61
|
manager_writer("opk", args.namereturn, args.pathreturn, args_writing, work)
|
|
62
62
|
print(f"File written in {args.pathreturn + args.namereturn}.opk.")
|
|
63
63
|
else:
|
|
@@ -44,8 +44,8 @@ def process_space_resection(args: argparse) -> Worksite:
|
|
|
44
44
|
work = Worksite("Space_Resection")
|
|
45
45
|
work = process_args_gen_param(args, work)
|
|
46
46
|
work.set_type_z_shot(check_header_file(list(args.output_header.upper()))[1])
|
|
47
|
-
pt2d = read_file_pt_dataframe(args.gcp2d, list(args.head_gcp2d.upper()), "pt2d")
|
|
48
|
-
pt3d = read_file_pt_dataframe(args.gcp3d, list(args.head_gcp3d.upper()), "pt3d")
|
|
47
|
+
pt2d, _ = read_file_pt_dataframe(args.gcp2d, list(args.head_gcp2d.upper()), "pt2d")
|
|
48
|
+
pt3d, _ = read_file_pt_dataframe(args.gcp3d, list(args.head_gcp3d.upper()), "pt3d")
|
|
49
49
|
pinit = {"coor_init": np.array(args.point3d)}
|
|
50
50
|
SpaceResection(work).space_resection_to_worksite(pt2d, pt3d, pinit)
|
|
51
51
|
return work
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Args of parser to transform projection of 3D points.
|
|
3
|
+
"""
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
from borea.process.p_add_data.p_file_gcp3d import args_gcp3d
|
|
7
|
+
from borea.process.p_add_data.p_proj import args_proj_param
|
|
8
|
+
from borea.process.p_add_data.p_write import args_writer
|
|
9
|
+
from borea.reader.reader_point import read_file_pt_dataframe
|
|
10
|
+
from borea.geodesy.proj_engine import ProjEngine
|
|
11
|
+
from borea.writer.writer_df_to_txt import write_df_to_txt
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def args_tf_proj_param(parser: argparse) -> argparse:
|
|
15
|
+
"""
|
|
16
|
+
Args for adding transform proj of points parameter.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
parser (argparse): Parser to add argument.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
argsparse: Parser with argument.
|
|
23
|
+
"""
|
|
24
|
+
parser = args_gcp3d(parser)
|
|
25
|
+
parser = args_proj_param(parser)
|
|
26
|
+
parser.add_argument('--oz', '--z_output',
|
|
27
|
+
type=str, choices=[None, 'altitude', 'height'], default=None,
|
|
28
|
+
help="Output type of z. altitude or height")
|
|
29
|
+
parser = args_writer(parser)
|
|
30
|
+
return parser
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def process_tf_proj_param(args: argparse) -> None:
|
|
34
|
+
"""
|
|
35
|
+
Processing args with data.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
args (argparse): Arg to apply on worksite (data).
|
|
39
|
+
"""
|
|
40
|
+
# Read file to Dataframe
|
|
41
|
+
df, type_z = read_file_pt_dataframe(args.gcp3d, args.head_gcp3d, "pt3d")
|
|
42
|
+
|
|
43
|
+
# Setup Projection
|
|
44
|
+
ProjEngine().set_epsg([args.epsg, args.geog, args.geoc], args.pathgeoid, args.oe)
|
|
45
|
+
|
|
46
|
+
# Change projection
|
|
47
|
+
new_df = ProjEngine().tf.transform_pt_proj(df, type_z, args.oz)
|
|
48
|
+
|
|
49
|
+
# Write the new file
|
|
50
|
+
write_df_to_txt(args.namereturn, args.pathreturn, new_df)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Photogrammetry site file reader module.
|
|
3
3
|
"""
|
|
4
4
|
import importlib
|
|
5
|
-
from
|
|
5
|
+
from borea.utils.check.check_path import check_path
|
|
6
6
|
from borea.worksite.worksite import Worksite
|
|
7
7
|
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ def reader_orientation(file: str, args: dict) -> Worksite:
|
|
|
19
19
|
"""
|
|
20
20
|
# Attention multiple file management orientation
|
|
21
21
|
# Attention management of files with the same extension but different formats
|
|
22
|
-
file =
|
|
22
|
+
file = check_path(file)
|
|
23
23
|
name_work = file.stem
|
|
24
24
|
ext = file.suffix[1:]
|
|
25
25
|
|
|
@@ -50,9 +50,9 @@ def read(file: Path, args: dict, work: Worksite) -> Worksite:
|
|
|
50
50
|
file_opk.close()
|
|
51
51
|
except FileNotFoundError as e:
|
|
52
52
|
raise FileNotFoundError(f"The path {file} is incorrect !!! "
|
|
53
|
-
f"or your os is {platform.system()}."
|
|
54
|
-
"For Windows path is \\,"
|
|
55
|
-
"
|
|
53
|
+
f"or your os is {platform.system()}. "
|
|
54
|
+
"For Windows path is \\, "
|
|
55
|
+
"for Linux and MacOS (Darwin) is / .") from e
|
|
56
56
|
|
|
57
57
|
work.type_z_shot = type_z
|
|
58
58
|
return work
|
borea/reader/reader_camera.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Script to read camera file txt or xml.
|
|
3
3
|
"""
|
|
4
|
-
from pathlib import Path
|
|
4
|
+
from pathlib import Path
|
|
5
5
|
from borea.datastruct.camera import Camera
|
|
6
|
+
from borea.utils.check.check_path import check_path
|
|
6
7
|
from borea.worksite.worksite import Worksite
|
|
7
8
|
|
|
8
9
|
|
|
@@ -15,7 +16,7 @@ def read_camera(files: list, work: Worksite) -> None:
|
|
|
15
16
|
work (Worksite): Worksite which needs camera data.
|
|
16
17
|
"""
|
|
17
18
|
for file in files:
|
|
18
|
-
camera_txt(
|
|
19
|
+
camera_txt(check_path(file), work)
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
def camera_txt(file: Path, work: Worksite) -> None:
|
borea/reader/reader_point.py
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Script to read point (connecting point, gcp2d gcp3d) format
|
|
3
3
|
.txt/.mes/.app with data arranged in columns.
|
|
4
4
|
"""
|
|
5
|
-
from pathlib import Path, PureWindowsPath
|
|
6
5
|
import pandas as pd
|
|
7
6
|
import numpy as np
|
|
7
|
+
from borea.utils.check.check_path import check_path
|
|
8
8
|
from borea.worksite.worksite import Worksite
|
|
9
9
|
from borea.utils.check.check_args_reader_pt import check_header_file
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@ def read_file_pt(path: str, header: list, type_point: str, work: Worksite) -> No
|
|
|
26
26
|
work.type_z_data = type_z
|
|
27
27
|
|
|
28
28
|
try:
|
|
29
|
-
with open(
|
|
29
|
+
with open(check_path(path), 'r', encoding="utf-8") as file_pts:
|
|
30
30
|
for pt in file_pts.readlines():
|
|
31
31
|
if pt != '\n' and pt[0] != '#':
|
|
32
32
|
info = pt.split()
|
|
@@ -53,7 +53,7 @@ def read_file_pt(path: str, header: list, type_point: str, work: Worksite) -> No
|
|
|
53
53
|
raise FileNotFoundError(f"The path {path} is incorrect !!!") from e
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
def read_file_pt_dataframe(path: str, header: list, type_point: str) ->
|
|
56
|
+
def read_file_pt_dataframe(path: str, header: list, type_point: str) -> tuple:
|
|
57
57
|
"""
|
|
58
58
|
Read file of points to save in Dataframe.
|
|
59
59
|
|
|
@@ -63,18 +63,18 @@ def read_file_pt_dataframe(path: str, header: list, type_point: str) -> pd.DataF
|
|
|
63
63
|
type_point (str): Type of point is reading (pt2d, pt3d).
|
|
64
64
|
|
|
65
65
|
Returns:
|
|
66
|
-
|
|
66
|
+
tuple: Dataframe of data and type of z in str.
|
|
67
67
|
"""
|
|
68
68
|
if type_point not in ["pt2d", "pt3d"]:
|
|
69
69
|
raise ValueError(f"type {type_point} in incorrect. ['pt2d', 'pt3d']")
|
|
70
70
|
|
|
71
|
-
header,
|
|
71
|
+
header, type_z = check_header_file(header, type_point)
|
|
72
72
|
|
|
73
73
|
id_pt = []
|
|
74
74
|
ttype = []
|
|
75
75
|
coor = []
|
|
76
76
|
try:
|
|
77
|
-
with open(
|
|
77
|
+
with open(check_path(path), 'r', encoding="utf-8") as file_pts:
|
|
78
78
|
for pt in file_pts.readlines():
|
|
79
79
|
if pt != '\n' and pt[0] != '#':
|
|
80
80
|
info = pt.split()
|
|
@@ -110,4 +110,4 @@ def read_file_pt_dataframe(path: str, header: list, type_point: str) -> pd.DataF
|
|
|
110
110
|
"id_shot": ttype,
|
|
111
111
|
"column": coor[:, 0],
|
|
112
112
|
"line": coor[:, 1]})
|
|
113
|
-
return df
|
|
113
|
+
return df, type_z
|
borea/stat/statistics.py
CHANGED
|
@@ -3,8 +3,8 @@ Module for statistics
|
|
|
3
3
|
"""
|
|
4
4
|
import os
|
|
5
5
|
import io
|
|
6
|
-
from pathlib import Path, PureWindowsPath
|
|
7
6
|
import numpy as np
|
|
7
|
+
from borea.utils.check.check_path import check_path
|
|
8
8
|
from borea.worksite.worksite import Worksite
|
|
9
9
|
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ class Stat:
|
|
|
22
22
|
type_point (list): List of type point on which we make the stats.
|
|
23
23
|
"""
|
|
24
24
|
self.work = work
|
|
25
|
-
self.pathoutput =
|
|
25
|
+
self.pathoutput = check_path(pathoutput)
|
|
26
26
|
|
|
27
27
|
if type_point is None:
|
|
28
28
|
self.type_point = []
|
|
@@ -28,9 +28,9 @@ def conv_z_shot_to_z_data(shot: Shot, type_z_shot: str, type_z_data: str,
|
|
|
28
28
|
|
|
29
29
|
if type_z_shot != type_z_data:
|
|
30
30
|
if type_z_shot == "height":
|
|
31
|
-
new_z = ProjEngine().tranform_altitude(pos_shot)
|
|
31
|
+
new_z = ProjEngine().tf.tranform_altitude(pos_shot)
|
|
32
32
|
else:
|
|
33
|
-
new_z = ProjEngine().tranform_height(pos_shot)
|
|
33
|
+
new_z = ProjEngine().tf.tranform_height(pos_shot)
|
|
34
34
|
pos_shot[2] = new_z
|
|
35
35
|
|
|
36
36
|
return pos_shot
|
|
@@ -51,8 +51,8 @@ def conv_output_z_type(coor: np.ndarray, type_z_input: str, type_z_output: str)
|
|
|
51
51
|
new_z = coor[2]
|
|
52
52
|
if type_z_input != type_z_output:
|
|
53
53
|
if type_z_input == "height":
|
|
54
|
-
new_z = ProjEngine().tranform_altitude(coor)
|
|
54
|
+
new_z = ProjEngine().tf.tranform_altitude(coor)
|
|
55
55
|
else:
|
|
56
|
-
new_z = ProjEngine().tranform_height(coor)
|
|
56
|
+
new_z = ProjEngine().tf.tranform_height(coor)
|
|
57
57
|
|
|
58
58
|
return np.array([coor[0], coor[1], new_z])
|
|
@@ -37,7 +37,7 @@ class ImageWorldShot():
|
|
|
37
37
|
Returns:
|
|
38
38
|
np.array: Cartographique coordinate [x,y,z].
|
|
39
39
|
"""
|
|
40
|
-
if type_z_data != type_z_shot and not ProjEngine().geog_to_geoid:
|
|
40
|
+
if type_z_data != type_z_shot and not ProjEngine().tf.geog_to_geoid:
|
|
41
41
|
raise ValueError("Missing geoid")
|
|
42
42
|
|
|
43
43
|
if not Dtm().path_dtm:
|
|
@@ -34,7 +34,7 @@ class WorldImageShot():
|
|
|
34
34
|
Returns:
|
|
35
35
|
np.array: The image coordinate [c,l].
|
|
36
36
|
"""
|
|
37
|
-
if type_z_data != type_z_shot and not ProjEngine().geog_to_geoid:
|
|
37
|
+
if type_z_data != type_z_shot and not ProjEngine().tf.geog_to_geoid:
|
|
38
38
|
raise ValueError("Missing geoid")
|
|
39
39
|
|
|
40
40
|
if self.shot.linear_alteration and not Dtm().path_dtm and not self.shot.approxeucli:
|
|
@@ -150,7 +150,7 @@ class WorldLeastSquare:
|
|
|
150
150
|
"""
|
|
151
151
|
v_res = np.zeros(nbr_obs)
|
|
152
152
|
coord_i, coord_j, data = [], [], []
|
|
153
|
-
for
|
|
153
|
+
for id_shot, pd_data in pd_mes_temp.groupby('id_img'):
|
|
154
154
|
shot = self.work.shots[id_shot]
|
|
155
155
|
cam = self.work.cameras[shot.name_cam]
|
|
156
156
|
|
|
@@ -13,6 +13,7 @@ from borea.transform_world_image.transform_shot.image_world_shot import ImageWor
|
|
|
13
13
|
# pylint: disable-next=line-too-long
|
|
14
14
|
from borea.transform_world_image.transform_worksite.image_world_intersection import WorldIntersection # noqa: E501
|
|
15
15
|
from borea.utils.miscellaneous.param_bundle import set_param_bundle_diff
|
|
16
|
+
from borea.utils.solver.solver import npsolve
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class SpaceResection:
|
|
@@ -240,8 +241,7 @@ class SpaceResection:
|
|
|
240
241
|
|
|
241
242
|
# Creation of A with mat_obs_axia
|
|
242
243
|
# Calculate dx = (A.T @ A)**-1 @ A.T @ B
|
|
243
|
-
return np.squeeze(
|
|
244
|
-
v_res, rcond=None)[0])
|
|
244
|
+
return np.squeeze(npsolve(self.mat_obs_axia(pt_eucli, shot_adjust), v_res))
|
|
245
245
|
|
|
246
246
|
def mat_obs_axia(self, pt_eucli: np.ndarray, imc_adjust: Shot) -> np.ndarray:
|
|
247
247
|
"""
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Script to check path of data.
|
|
3
|
+
"""
|
|
4
|
+
from pathlib import Path, PureWindowsPath, PurePosixPath
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def check_path(file: str) -> Path:
|
|
8
|
+
"""
|
|
9
|
+
Check path of data if Posix of Windows path.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
file (str): The path of data.
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
Path: The good path.
|
|
16
|
+
"""
|
|
17
|
+
file = Path(file)
|
|
18
|
+
name = file.stem
|
|
19
|
+
|
|
20
|
+
if "/" in name:
|
|
21
|
+
return Path(PurePosixPath(file))
|
|
22
|
+
|
|
23
|
+
if "\\" in name:
|
|
24
|
+
return Path(PureWindowsPath(file))
|
|
25
|
+
|
|
26
|
+
return file
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Least square solver used by Borea
|
|
3
|
+
"""
|
|
4
|
+
import numpy as np
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def npsolve(mat_a: np.ndarray, mat_b: np.ndarray) -> np.ndarray:
|
|
8
|
+
"""
|
|
9
|
+
Solver used by Borea to resolve Ax = B
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
mat_a (np.ndarray): Matrix A
|
|
13
|
+
mat_b (np.ndarray): Matrix B
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
np.ndarray: the result x
|
|
17
|
+
"""
|
|
18
|
+
return np.linalg.lstsq(mat_a, mat_b, rcond=None)[0]
|
borea/worksite/worksite.py
CHANGED
|
@@ -173,8 +173,10 @@ class Worksite(Workdata):
|
|
|
173
173
|
self.type_z_shot, False)[2]
|
|
174
174
|
shot.set_z_nadir(z_nadir)
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
# pylint: disable-next=too-many-arguments too-many-positional-arguments
|
|
177
|
+
def set_unit_output(self, type_z: str = None, unit_angle: str = None,
|
|
178
|
+
linear_alteration: bool = None, order_axe: str = None,
|
|
179
|
+
proj_output: bool = True) -> None:
|
|
178
180
|
"""
|
|
179
181
|
Allows you to change unit or parameter of shots.
|
|
180
182
|
|
|
@@ -183,6 +185,7 @@ class Worksite(Workdata):
|
|
|
183
185
|
unit_angle (str): Unit angle you want.
|
|
184
186
|
linear_alteration (bool): True if you want data corrected.
|
|
185
187
|
order_axe (str): Order of rotation matrice you want in your angle.
|
|
188
|
+
proj_output (bool): True to change the projection of shot.
|
|
186
189
|
"""
|
|
187
190
|
if unit_angle not in ["degree", "radian", None]:
|
|
188
191
|
raise ValueError(f"unit_angle: {unit_angle} is not recognized,"
|
|
@@ -198,14 +201,16 @@ class Worksite(Workdata):
|
|
|
198
201
|
self.type_z_shot = type_z
|
|
199
202
|
|
|
200
203
|
for shot in self.shots.values():
|
|
201
|
-
if unit_angle
|
|
204
|
+
if unit_angle:
|
|
202
205
|
shot.set_unit_angle(unit_angle)
|
|
203
|
-
if type_z
|
|
206
|
+
if type_z:
|
|
204
207
|
shot.set_type_z(type_z)
|
|
205
208
|
if linear_alteration is not None:
|
|
206
209
|
shot.set_linear_alteration(linear_alteration)
|
|
207
|
-
if order_axe
|
|
210
|
+
if order_axe:
|
|
208
211
|
shot.set_order_axe(order_axe)
|
|
212
|
+
if self.epsg_output and proj_output:
|
|
213
|
+
shot.set_proj_pos()
|
|
209
214
|
|
|
210
215
|
def calculate_barycentre(self) -> np.ndarray:
|
|
211
216
|
"""
|
borea/writer/writer_con.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Photogrammetry worksite to writing in rpc.
|
|
3
3
|
"""
|
|
4
4
|
import os
|
|
5
|
-
from
|
|
5
|
+
from borea.utils.check.check_path import check_path
|
|
6
6
|
from borea.worksite.worksite import Worksite
|
|
7
7
|
from borea.geodesy.proj_engine import ProjEngine
|
|
8
8
|
from borea.format.conl import Conl
|
|
@@ -20,10 +20,17 @@ def write(name: str, folder_con: str, param_con: dict, work: Worksite) -> None:
|
|
|
20
20
|
work (Worksite): The site to be recorded.
|
|
21
21
|
"""
|
|
22
22
|
_, _ = name, param_con
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
if work.epsg_output:
|
|
25
|
+
epsg_output = ProjEngine().epsg_output
|
|
26
|
+
else:
|
|
27
|
+
epsg_output = ProjEngine().epsg[0]
|
|
28
|
+
|
|
29
|
+
work.set_unit_output(type_z="altitude", linear_alteration=True)
|
|
30
|
+
geoview_proj = search_info("EPSG", str(epsg_output), "GEOVIEW")
|
|
24
31
|
|
|
25
32
|
for name_shot, shot in work.shots.items():
|
|
26
33
|
cam = work.cameras[shot.name_cam]
|
|
27
|
-
path_conical = os.path.join(
|
|
34
|
+
path_conical = os.path.join(check_path(folder_con), f"{name_shot}.CON")
|
|
28
35
|
|
|
29
36
|
Conl(shot, cam, geoview_proj).save_conl(path_conical)
|
borea/writer/writer_df_to_txt.py
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Photogrammetry worksite to writing dataframe to txt.
|
|
3
3
|
"""
|
|
4
4
|
import os
|
|
5
|
-
from pathlib import Path, PureWindowsPath
|
|
6
5
|
import pandas as pd
|
|
6
|
+
from borea.utils.check.check_path import check_path
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def write_df_to_txt(name: str, pathreturn: str, df: pd.DataFrame) -> None:
|
|
@@ -15,7 +15,7 @@ def write_df_to_txt(name: str, pathreturn: str, df: pd.DataFrame) -> None:
|
|
|
15
15
|
pathreturn (str): Path to save the file.
|
|
16
16
|
df (pd.DataFrame): DataFrame to save.
|
|
17
17
|
"""
|
|
18
|
-
path_txt = os.path.join(
|
|
18
|
+
path_txt = os.path.join(check_path(pathreturn), f"{name}.txt")
|
|
19
19
|
|
|
20
20
|
name_column = list(df.columns)
|
|
21
21
|
|
borea/writer/writer_opk.py
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Photogrammetry worksite to writing in opk.
|
|
3
3
|
"""
|
|
4
4
|
import os
|
|
5
|
-
from pathlib import Path, PureWindowsPath
|
|
6
5
|
import numpy as np
|
|
6
|
+
from borea.utils.check.check_path import check_path
|
|
7
7
|
from borea.worksite.worksite import Worksite
|
|
8
8
|
from borea.utils.check.check_args_opk import check_header_file
|
|
9
9
|
|
|
@@ -24,7 +24,7 @@ def write(name_opk: str, path_opk: str, args: dict, work: Worksite) -> None:
|
|
|
24
24
|
linear alteration.
|
|
25
25
|
work (Worksite): The site to be recorded.
|
|
26
26
|
"""
|
|
27
|
-
path_opk = os.path.join(
|
|
27
|
+
path_opk = os.path.join(check_path(path_opk), f"{name_opk}.opk")
|
|
28
28
|
|
|
29
29
|
if args["header"]:
|
|
30
30
|
header, type_z = check_header_file(args["header"])
|
|
@@ -35,7 +35,7 @@ def write(name_opk: str, path_opk: str, args: dict, work: Worksite) -> None:
|
|
|
35
35
|
if "S" in header:
|
|
36
36
|
raise ValueError("Letter S doesn't existe in writing header opk.")
|
|
37
37
|
|
|
38
|
-
work.
|
|
38
|
+
work.set_unit_output(type_z, args["unit_angle"], args["linear_alteration"], args["order_axe"])
|
|
39
39
|
|
|
40
40
|
header_file = ""
|
|
41
41
|
for i in header:
|
borea/writer/writer_rpc.py
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Photogrammetry worksite to writing in rpc.
|
|
3
3
|
"""
|
|
4
4
|
import os
|
|
5
|
-
from pathlib import Path, PureWindowsPath
|
|
6
5
|
from borea.format.rpc import Rpc
|
|
6
|
+
from borea.utils.check.check_path import check_path
|
|
7
7
|
from borea.worksite.worksite import Worksite
|
|
8
8
|
from borea.datastruct.dtm import Dtm
|
|
9
9
|
|
|
@@ -20,6 +20,7 @@ def write(name: str, folder_rpc: str, param_rpc: dict, work: Worksite) -> None:
|
|
|
20
20
|
"size_grid"; size of the grip to calcule rpc.
|
|
21
21
|
"order"; order of the polynome of the rpc.
|
|
22
22
|
"fact_rpc"; rpc factor for world coordinate when src is not WGS84.
|
|
23
|
+
"epsg_output"; code epsg for RPC.
|
|
23
24
|
work (Worksite): The site to be recorded.
|
|
24
25
|
"""
|
|
25
26
|
_ = name
|
|
@@ -28,7 +29,9 @@ def write(name: str, folder_rpc: str, param_rpc: dict, work: Worksite) -> None:
|
|
|
28
29
|
"SAMP_SCALE", "LAT_SCALE", "LONG_SCALE",
|
|
29
30
|
"HEIGHT_SCALE"]
|
|
30
31
|
|
|
31
|
-
work.
|
|
32
|
+
param_rpc["epsg_output"] = work.epsg_output
|
|
33
|
+
|
|
34
|
+
work.set_unit_output(type_z=Dtm().type_dtm, proj_output=False)
|
|
32
35
|
|
|
33
36
|
for name_shot, shot in work.shots.items():
|
|
34
37
|
cam = work.cameras[shot.name_cam]
|
|
@@ -50,6 +53,6 @@ def write(name: str, folder_rpc: str, param_rpc: dict, work: Worksite) -> None:
|
|
|
50
53
|
for idx, val in enumerate(rpc.param_rpc["SAMP_DEN_COEFF"]):
|
|
51
54
|
list_txt_rpc += [f"SAMP_DEN_COEFF_{idx + 1}: {val}"]
|
|
52
55
|
|
|
53
|
-
path_rpc = os.path.join(
|
|
56
|
+
path_rpc = os.path.join(check_path(folder_rpc),
|
|
54
57
|
f"{name_shot}_RPC.TXT")
|
|
55
|
-
|
|
58
|
+
check_path(path_rpc).write_text("\n".join(list_txt_rpc), encoding="UTF-8")
|
|
@@ -13,8 +13,8 @@ from borea.process.p_format.p_write_opk import args_writing_opk, process_args_wr
|
|
|
13
13
|
|
|
14
14
|
def spaceresection_opk():
|
|
15
15
|
"""
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
Produces an OPK file from image link points and their field coordinates
|
|
17
|
+
coordinates (calculates the 6 external parameters for each image with a point)
|
|
18
18
|
"""
|
|
19
19
|
parser = argparse.ArgumentParser(description='Space resection of point file image and world'
|
|
20
20
|
' to calculate 6 externals parameters of shots')
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Main to transform projection of 3D points.
|
|
3
|
+
"""
|
|
4
|
+
# pylint: disable=import-error, wrong-import-position, line-too-long
|
|
5
|
+
import argparse
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
|
|
10
|
+
from borea.process.p_func.p_tf_proj_pt import args_tf_proj_param, process_tf_proj_param # noqa: E402, E501
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def transform_proj_pt():
|
|
14
|
+
"""
|
|
15
|
+
Transforms the projection of a point file by pyproj.
|
|
16
|
+
"""
|
|
17
|
+
parser = argparse.ArgumentParser(description='Transform coordinate projection of the 3D points'
|
|
18
|
+
' file.')
|
|
19
|
+
|
|
20
|
+
# Args
|
|
21
|
+
parser = args_tf_proj_param(parser)
|
|
22
|
+
|
|
23
|
+
args = parser.parse_args()
|
|
24
|
+
|
|
25
|
+
# Process data
|
|
26
|
+
process_tf_proj_param(args)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
transform_proj_pt()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ign-borea
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A package to manipulate orientation files
|
|
5
5
|
Author-email: Antoine Cornu <antoine.cornu@ign.fr>, Nicolas Laurain <nicolas.laurain@ign.fr>
|
|
6
6
|
License: MIT License
|
|
@@ -53,8 +53,6 @@ Requires-Dist: dataclasses ; extra == 'dev'
|
|
|
53
53
|
Requires-Dist: pyproj ; extra == 'dev'
|
|
54
54
|
Requires-Dist: scipy ; extra == 'dev'
|
|
55
55
|
Requires-Dist: pandas ; extra == 'dev'
|
|
56
|
-
Requires-Dist: build ; extra == 'dev'
|
|
57
|
-
Requires-Dist: twine ; extra == 'dev'
|
|
58
56
|
|
|
59
57
|
[](https://www.ign.fr/) [](
|
|
60
58
|
https://pypi.org/project/ign-borea/)
|
|
@@ -101,6 +99,7 @@ Some tools are already implemented in the library:
|
|
|
101
99
|
* Transforms coordinates file terrain from image: `ptfile-image-to-world -h` [doc](https://github.com/IGNF/Borea/tree/main/borea_tools/docs_tools/README_ptfile_image_to_world.md)
|
|
102
100
|
* Transforms coordinates file image from terrain: `ptfile-world-to-image -h` [doc](https://github.com/IGNF/Borea/tree/main/borea_tools/docs_tools/README_ptfile_world_to_image.md)
|
|
103
101
|
* Calculates opk by space resection: `spaceresection-opk -h` [doc](https://github.com/IGNF/Borea/tree/main/borea_tools/docs_tools/README_spaceresection_opk.md)
|
|
102
|
+
* Transform projection of points file: `transform-proj-points -h` [doc](./borea_tools/docs_tools/README_transform_proj_points.md)
|
|
104
103
|
|
|
105
104
|
## Read data and instantiate worksite
|
|
106
105
|
|