Geography — GPS Coordinate Utilities
In order to build a SectionArray, mechaphlowers needs span length and line angle data. These are the primary geometric inputs for any computation.
In practice, support positions may be known as GPS coordinates (latitude / longitude), or as Lambert 93 coordinates. Therefore, one may want to generate GPS/Lambert coordinates from the section geometry or, conversely, recover the section geometry from GPS/Lambert surveys.
Overview
| API | Direction | Description |
|---|---|---|
SectionArray.set_starting_gps / get_gps |
Section geometry ➜ GPS | High-level: set origin on SectionArray, retrieve GPS for all pylons |
SectionArray.set_starting_lambert93 / get_lambert93 |
Section geometry ➜ Lambert 93 | High-level: set Lambert 93 origin, retrieve Lambert 93 for all pylons |
GeoLocator |
Section geometry ➜ GPS / Lambert 93 | Low-level computation class used internally by SectionArray |
get_gps_from_arrays |
Section geometry ➜ GPS coordinates | Standalone function |
get_dist_and_angles_from_gps |
GPS coordinates ➜ Section geometry | Standalone function |
get_dist_and_angles_from_lambert |
Lambert 93 ➜ Section geometry | Standalone function |
Using GeoLocator via SectionArray
The recommended way to work with GPS and Lambert 93 coordinates on a section is through SectionArray, which owns a GeoLocator instance. You set the starting point once, then call get_gps() or get_lambert93() to compute coordinates for all pylons on demand.
Set starting point from GPS, retrieve GPS coordinates
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
Set starting point from Lambert 93, retrieve Lambert 93 coordinates
1 2 3 4 5 6 7 8 9 10 | |
Error: starting point not set
Accessing coordinates before setting a starting point raises GpsNoDataAvailable:
1 2 3 4 5 6 7 | |
See Error Classes for details.
Low-level: GeoLocator class
GeoLocator is the computation object that SectionArray delegates to. It can also be used directly if you want to manage the starting point independently of a SectionArray.
1 2 3 4 5 6 7 8 9 10 11 | |
GeoLocator stores only the starting point and azimuth — no computed arrays are cached. Every call to get_gps() / get_lambert93() recomputes from the stored starting point.
See Entities Geography API for the full class reference.
From span lengths and angles to GPS
Purpose
Starting from a single GPS origin and an initial azimuth (direction of the first span), this function iteratively builds the GPS position of every support in the section using:
- the line angles,
- the span lengths.
Internally, the function converts all angles to radians, computes cumulative bearings, and applies the reverse Haversine formula at each step.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
Each returned array has one element per support (length = number of supports).
From GPS to span lengths and angles
Purpose
Given arrays of GPS coordinates (one per support), this function recovers:
- the distances between consecutive supports (in meters), and
- the relative line angles at each support (in degrees).
This is the "inverse" direction: from a real-world GPS survey back to the section geometry needed by mechaphlowers.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |