Class LocalXyWgs84Util
Defined in File local_xy_util.h
Class Documentation
-
class LocalXyWgs84Util
Utility class for converting between WGS84 lat/lon and an ortho-rectified LocalXY coordinate system.
To use this class, first construct it with a reference origin. The reference origin should be a latitude, longitude, angle, and altitude in WGS84 coordinates. Once initialized, a LocalXyWgs84Util can be used to convert WGS84 coordinates to and from an ortho-rectified frame with its origin at the reference origin. Because the earth is spherical, the error in the ortho-rectified frame will accumulate as the distance from the reference origin increases. For this reason, the reference origin should be chosen to be close to the region of interest (<10 km).
It is strongly recommended to use 0 degrees for the angle. This corresponds to the X-axis of the ortho-rectified frame pointing east.
Public Functions
Initializing constructor
This constructor creates and initializes a LocalXyWgs84Util.
- Parameters:
reference_latitude – [in] Reference latitude in degrees.
reference_longitude – [in] Reference longitude in degrees.
reference_angle – [in] Reference angle in degrees ENU.
reference_altitude – [in] Reference altitude in meters.
Zero-argument constructor.
This constructor creates an uninitialized LocalXyWgs84Util. This constructor is only used to create placeholder objects in containers that require a zero-argument constructor.
-
inline bool Initialized() const
Return whether the object has been initialized
The object is not usable unless it has been initialized (see the two constructors).
- Returns:
True if initialized, false otherwise.
-
void ResetInitialization()
Reset to “not Initialized”. Useful when the local_xy_origin changes and we want this class to be updated.
-
double ReferenceLongitude() const
Return the longitude coordinate of the local origin
- Returns:
The WGS84 longitude coordinate of the local origin in degrees
-
double ReferenceLatitude() const
Return the latitude coordinate of the local origin
- Returns:
The WGS84 latitude coordinate of the local origin in degrees
-
double ReferenceAngle() const
Return the reference angle in degrees ENU.
-
double ReferenceAltitude() const
Return the altitude coordinate of the local origin
- Returns:
The WGS84 altitude coordinate of the local origin in meters
-
inline std::string Frame() const
Return the TF frame ID corresponding to the local origin
- Returns:
The TF frame ID corresponding to the local origin
-
inline std::string NormalizedFrame() const
Return the TF frame ID corresponding to the local origin with a leading slash
- Returns:
The TF frame ID corresponding to the local origin with a leading slash
-
bool ToLocalXy(double latitude, double longitude, double &x, double &y) const
Convert WGS84 latitude and longitude to LocalXY.
- Parameters:
latitude – [in] Latitude value in degrees.
longitude – [in] Longitude value in degrees.
x – [out] X coordinate in meters from origin.
y – [out] Y coordinate in meters from origin.
- Returns:
True if the conversion is possible.
-
bool ToWgs84(double x, double y, double &latitude, double &longitude) const
Convert LocalXY to WGS84 latitude and longitude.
- Parameters:
x – [in] X coordinate in meters from origin.
y – [in] Y coordinate in meters from origin.
latitude – [out] Latitude value in degrees.
longitude – [out] Longitude value in degrees.
- Returns:
True if the conversion is possible.