geography
GeoLocator
GeoLocator()
Stores a starting GPS point and azimuth, then computes pylon GPS/Lambert93 coordinates on demand.
The starting point must be set via set_starting_gps() or set_starting_lambert93() before calling get_gps() or get_lambert93(). No computed arrays are cached; every call to get_gps() / get_lambert93() recomputes from the stored starting point and the provided arrays.
Source code in src/mechaphlowers/entities/geography.py
253 254 255 256 | |
get_gps
get_gps(
line_angles_degrees: ndarray, span_length: ndarray
) -> tuple[ndarray, ndarray]
Compute GPS coordinates for all pylons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Line angle array in degrees, anti-clockwise. |
required |
|
ndarray
|
Span length array in meters (last value is NaN). |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: (latitudes, longitudes) in decimal degrees. |
Source code in src/mechaphlowers/entities/geography.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
get_lambert93
get_lambert93(
line_angles_degrees: ndarray, span_length: ndarray
) -> tuple[ndarray, ndarray]
Compute Lambert 93 coordinates for all pylons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Line angle array in degrees, anti-clockwise. |
required |
|
ndarray
|
Span length array in meters (last value is NaN). |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: (easting, northing) in Lambert 93 meters. |
Source code in src/mechaphlowers/entities/geography.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
set_starting_gps
set_starting_gps(
latitude_0: float, longitude_0: float, azimuth_0: float
) -> None
Set the starting GPS point and azimuth for the section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
Latitude of the first support in decimal degrees. |
required |
|
float
|
Longitude of the first support in decimal degrees. |
required |
|
float
|
Azimuth of the first span in degrees, anti-clockwise. 0 means North, 90 means West. |
required |
Source code in src/mechaphlowers/entities/geography.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
set_starting_lambert93
Set the starting point from Lambert 93 coordinates and azimuth.
Converts the Lambert 93 easting/northing to GPS (WGS84) then stores the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
Lambert 93 easting coordinate in meters. |
required |
|
float
|
Lambert 93 northing coordinate in meters. |
required |
|
float
|
Azimuth of the first span in degrees, anti-clockwise. 0 means North, 90 means West. |
required |
Source code in src/mechaphlowers/entities/geography.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
geo_info_from_gps
geo_info_from_gps(
lats: ndarray, lons: ndarray
) -> SupportGeoInfo
Create a list of support geo info from a list of gps points. Args: gps_points: A list of gps points. Returns: A list of support geo info.
Source code in src/mechaphlowers/entities/geography.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
get_azimuth_from_gps
get_azimuth_from_gps(
lats: ndarray,
lons: ndarray,
unit: Literal['rad', 'deg'] = 'rad',
) -> ndarray
Get azimuth of spans using gps coordinates of supports
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
array of latitudes of the supports |
required |
|
ndarray
|
array of longitudes of the supports |
required |
|
Literal['rad', 'deg']
|
Select the unit to use for both inputs and output. Defaults to "rad" |
'rad'
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Bearing angle in degrees from north, anti clockwise (in radians by default) |
Source code in src/mechaphlowers/entities/geography.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
get_azimuth_from_line_angles
get_azimuth_from_line_angles(
line_angle: ndarray,
first_span_azimuth: float,
input_unit: str = 'deg',
output_unit: str = 'deg',
) -> ndarray
Compute azimuth of all spans.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
line angle array in anticlockwise direction. Array comes from SectionArray. |
required |
|
float
|
azimuth of the first span. Anticlockwise: 90° towards west |
required |
|
str
|
unit of line_angle and line_angle. Defaults to "deg". |
'deg'
|
|
str
|
unit of the output. Defaults to "deg". |
'deg'
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: array of azimuth. Length of array is number of supports. |
Source code in src/mechaphlowers/entities/geography.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
get_dist_and_angles_from_gps
get_dist_and_angles_from_gps(
latitudes_deg: ndarray,
longitudes_deg: ndarray,
unit_output_angles: Literal[
'rad', 'deg', 'grad'
] = 'deg',
) -> tuple[ndarray, ndarray]
Compute distances and angles between supports using latitudes and longitudes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
array of latitudes in decimal degrees |
required |
|
ndarray
|
array of longitudes in decimal degrees |
required |
|
Literal['rad', 'deg', 'grad']
|
unit of the output angles. Defaults to "deg". |
'deg'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If latitudes and longitudes arrays have different lengths, or unit_output_angles is not valid. |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: tuple (distance, angles) distance is in meters and angles is anti-clockwise |
Source code in src/mechaphlowers/entities/geography.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
get_dist_and_angles_from_lambert
get_dist_and_angles_from_lambert(
lambert_east: ndarray,
lambert_north: ndarray,
unit_output_angles: Literal[
'rad', 'deg', 'grad'
] = 'deg',
) -> tuple[ndarray, ndarray]
Compute distances and angles between supports using lambert coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Lambert 93 Easting coordinate. |
required |
|
ndarray
|
Lambert 93 Northing coordinate. |
required |
|
Literal['rad', 'deg', 'grad']
|
unit of the output angles. Defaults to "deg". |
'deg'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If lambert east and north arrays have different lengths, or unit_output_angles is not valid. |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: tuple (distance, angles) distance is in meters and angles is anti-clockwise |
Source code in src/mechaphlowers/entities/geography.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
get_gps_from_arrays
get_gps_from_arrays(
start_lat_deg: float,
start_lon_deg: float,
azimuth_deg: float,
line_angles_degrees: ndarray,
span_length: ndarray,
) -> tuple[ndarray, ndarray]
Gets arrays of line angle and span length, and starting point data.
Builds iteratively all the gps points using the input arrays.
Input and output are in degrees. This function converts in radians in order to use reverse_haversine_float()
span_length and line_angles_degrees come from SectionArray. Their data is based on support view. Therefore: - last value of span_length is np.nan - first and last value are only relevant for support orientation, and not considered for this computation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
latitude of the first point |
required |
|
float
|
longitude of the first point |
required |
|
float
|
azimuth of the first span in degrees, anti-clockwise. 0 means North, 90 means West. |
required |
|
ndarray
|
line angle array (data from SectionArray), in degrees, anti-clockwise |
required |
|
ndarray
|
span length array (data from SectionArray) |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: (lat, lon) two arrays of GPS coordinates. Angles in degrees |
Source code in src/mechaphlowers/entities/geography.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |