QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCGeo Namespace Reference

Functions

void convertGeoToNed (const QGeoCoordinate &coord, const QGeoCoordinate &origin, double &x, double &y, double &z)
 
void convertNedToGeo (double x, double y, double z, const QGeoCoordinate &origin, QGeoCoordinate &coord)
 
QVector3D convertGpsToEnu (const QGeoCoordinate &coord, const QGeoCoordinate &ref)
 
QGeoCoordinate convertEnuToGps (const QVector3D &enu, const QGeoCoordinate &ref)
 
QVector3D convertGeodeticToEcef (const QGeoCoordinate &coord)
 
QGeoCoordinate convertEcefToGeodetic (const QVector3D &ecef)
 
QVector3D convertEcefToEnu (const QVector3D &ecef, const QGeoCoordinate &ref)
 
QVector3D convertEnuToEcef (const QVector3D &enu, const QGeoCoordinate &ref)
 
int convertGeoToUTM (const QGeoCoordinate &coord, double &easting, double &northing)
 
bool convertUTMToGeo (double easting, double northing, int zone, bool southhemi, QGeoCoordinate &coord)
 
QString convertGeoToMGRS (const QGeoCoordinate &coord)
 
bool convertMGRSToGeo (const QString &mgrs, QGeoCoordinate &coord)
 
double geodesicDistance (const QGeoCoordinate &from, const QGeoCoordinate &to)
 
double geodesicAzimuth (const QGeoCoordinate &from, const QGeoCoordinate &to)
 
QGeoCoordinate geodesicDestination (const QGeoCoordinate &from, double azimuth, double distance)
 
double pathLength (const QList< QGeoCoordinate > &path)
 
double polygonArea (const QList< QGeoCoordinate > &polygon)
 
double polygonPerimeter (const QList< QGeoCoordinate > &polygon)
 
QList< QGeoCoordinate > interpolatePath (const QGeoCoordinate &from, const QGeoCoordinate &to, int numPoints)
 
QGeoCoordinate interpolateAtDistance (const QGeoCoordinate &from, const QGeoCoordinate &to, double distance)
 

Function Documentation

◆ convertEcefToEnu()

QVector3D QGCGeo::convertEcefToEnu ( const QVector3D &  ecef,
const QGeoCoordinate &  ref 
)

Convert ECEF to ENU relative to a reference point.

Parameters
ecefECEF vector in meters.
refReference point for local tangent plane.
Returns
ENU vector in meters.

Definition at line 116 of file QGCGeo.cc.

References convertEcefToEnu().

Referenced by convertEcefToEnu().

◆ convertEcefToGeodetic()

QGeoCoordinate QGCGeo::convertEcefToGeodetic ( const QVector3D &  ecef)

Convert ECEF (Earth-Centered Earth-Fixed) to geodetic coordinate.

Parameters
ecefECEF vector in meters.
Returns
Geodetic coordinate (lat/lon/alt).

Definition at line 109 of file QGCGeo.cc.

References convertEcefToGeodetic().

Referenced by convertEcefToGeodetic().

◆ convertEnuToEcef()

QVector3D QGCGeo::convertEnuToEcef ( const QVector3D &  enu,
const QGeoCoordinate &  ref 
)

Convert ENU to ECEF relative to a reference point.

Parameters
enuENU vector in meters.
refReference point for local tangent plane.
Returns
ECEF vector in meters.

Definition at line 130 of file QGCGeo.cc.

References convertEnuToEcef().

Referenced by convertEnuToEcef().

◆ convertEnuToGps()

QGeoCoordinate QGCGeo::convertEnuToGps ( const QVector3D &  enu,
const QGeoCoordinate &  ref 
)

Convert ENU (East-North-Up) coordinate to geodetic.

Parameters
enuENU vector in meters (x=East, y=North, z=Up).
refReference point for local tangent plane.
Returns
Geodetic coordinate.

Definition at line 89 of file QGCGeo.cc.

References convertEnuToGps().

Referenced by convertEnuToGps().

◆ convertGeodeticToEcef()

QVector3D QGCGeo::convertGeodeticToEcef ( const QGeoCoordinate &  coord)

Convert geodetic coordinate to ECEF (Earth-Centered Earth-Fixed).

Parameters
coordGeodetic coordinate (lat/lon/alt).
Returns
ECEF vector in meters.
Note
Uses float precision (QVector3D). Large coordinates may lose precision.

Definition at line 102 of file QGCGeo.cc.

References convertGeodeticToEcef().

Referenced by convertGeodeticToEcef().

◆ convertGeoToMGRS()

QString QGCGeo::convertGeoToMGRS ( const QGeoCoordinate &  coord)

Convert geodetic coordinate to MGRS string.

Parameters
coordGeodetic coordinate to convert.
Returns
MGRS string (e.g., "32TMT 65886 47092"), or empty string on failure.

Definition at line 179 of file QGCGeo.cc.

References convertGeoToMGRS().

Referenced by VehicleGPSFactGroup::_handleGpsRawInt(), VehicleGPSFactGroup::_handleHighLatency(), VehicleGPSFactGroup::_handleHighLatency2(), and convertGeoToMGRS().

◆ convertGeoToNed()

void QGCGeo::convertGeoToNed ( const QGeoCoordinate &  coord,
const QGeoCoordinate &  origin,
double &  x,
double &  y,
double &  z 
)

Convert geodetic coordinate to NED (North-East-Down) relative to origin.

Parameters
coordGeodetic coordinate to convert.
originReference point for local tangent plane.
[out]xNorth component in meters.
[out]yEast component in meters.
[out]zDown component in meters (positive = below origin).
Note
NaN altitudes are treated as 0.0 (sea level).

Definition at line 34 of file QGCGeo.cc.

References convertGeoToNed().

Referenced by convertGeoToNed(), QGCMapPolygon::nedPolygon(), and QGCMapPolyline::nedPolyline().

◆ convertGeoToUTM()

int QGCGeo::convertGeoToUTM ( const QGeoCoordinate &  coord,
double &  easting,
double &  northing 
)

Convert geodetic coordinate to UTM.

Parameters
coordGeodetic coordinate to convert.
[out]eastingUTM easting in meters.
[out]northingUTM northing in meters.
Returns
UTM zone (1-60), or 0 on failure.

Definition at line 148 of file QGCGeo.cc.

References convertGeoToUTM().

Referenced by convertGeoToUTM().

◆ convertGpsToEnu()

QVector3D QGCGeo::convertGpsToEnu ( const QGeoCoordinate &  coord,
const QGeoCoordinate &  ref 
)

Convert geodetic coordinate to ENU (East-North-Up) relative to reference.

Parameters
coordGeodetic coordinate to convert.
refReference point for local tangent plane.
Returns
ENU vector in meters (x=East, y=North, z=Up).
Note
Uses float precision (QVector3D). For high precision, use NED functions.

Definition at line 80 of file QGCGeo.cc.

References convertGpsToEnu().

Referenced by convertGpsToEnu(), and OsmBuildingHandler::way().

◆ convertMGRSToGeo()

bool QGCGeo::convertMGRSToGeo ( const QString &  mgrs,
QGeoCoordinate &  coord 
)

Convert MGRS string to geodetic coordinate.

Parameters
mgrsMGRS string (spaces optional, e.g., "32TMT6588647092" or "32T MT 65886 47092").
[out]coordResulting geodetic coordinate (altitude = 0).
Returns
True on success, false on failure.

Definition at line 205 of file QGCGeo.cc.

References convertMGRSToGeo().

Referenced by convertMGRSToGeo().

◆ convertNedToGeo()

void QGCGeo::convertNedToGeo ( double  x,
double  y,
double  z,
const QGeoCoordinate &  origin,
QGeoCoordinate &  coord 
)

Convert NED (North-East-Down) coordinate to geodetic.

Parameters
xNorth component in meters.
yEast component in meters.
zDown component in meters (positive = below origin).
originReference point for local tangent plane.
[out]coordResulting geodetic coordinate.

Definition at line 56 of file QGCGeo.cc.

References convertNedToGeo().

Referenced by convertNedToGeo(), QGCMapPolygon::offset(), and QGCMapPolyline::offsetPolyline().

◆ convertUTMToGeo()

bool QGCGeo::convertUTMToGeo ( double  easting,
double  northing,
int  zone,
bool  southhemi,
QGeoCoordinate &  coord 
)

Convert UTM to geodetic coordinate.

Parameters
eastingUTM easting in meters.
northingUTM northing in meters.
zoneUTM zone (1-60).
southhemiTrue if southern hemisphere.
[out]coordResulting geodetic coordinate (altitude = 0).
Returns
True on success, false on failure.

Definition at line 161 of file QGCGeo.cc.

References convertUTMToGeo().

Referenced by convertUTMToGeo(), SHPFileHelper::loadPointsFromFile(), SHPFileHelper::loadPolygonsFromFile(), and SHPFileHelper::loadPolylinesFromFile().

◆ geodesicAzimuth()

double QGCGeo::geodesicAzimuth ( const QGeoCoordinate &  from,
const QGeoCoordinate &  to 
)

Calculate geodesic azimuth (bearing) from one coordinate to another using WGS84 ellipsoid.

Parameters
fromStarting coordinate.
toEnding coordinate.
Returns
Forward azimuth in degrees [0, 360), clockwise from north.
Note
More accurate than QGeoCoordinate::azimuthTo() which uses spherical approximation.

Definition at line 237 of file QGCGeo.cc.

References geodesicAzimuth().

Referenced by geodesicAzimuth().

◆ geodesicDestination()

QGeoCoordinate QGCGeo::geodesicDestination ( const QGeoCoordinate &  from,
double  azimuth,
double  distance 
)

Calculate destination coordinate given start point, azimuth, and distance using WGS84 ellipsoid.

Parameters
fromStarting coordinate.
azimuthForward azimuth in degrees, clockwise from north.
distanceDistance in meters.
Returns
Destination coordinate (altitude copied from start).

Definition at line 250 of file QGCGeo.cc.

References geodesicDestination().

Referenced by geodesicDestination().

◆ geodesicDistance()

double QGCGeo::geodesicDistance ( const QGeoCoordinate &  from,
const QGeoCoordinate &  to 
)

Calculate geodesic distance between two coordinates using WGS84 ellipsoid.

Parameters
fromStarting coordinate.
toEnding coordinate.
Returns
Distance in meters.
Note
More accurate than QGeoCoordinate::distanceTo() which uses spherical approximation.

Definition at line 229 of file QGCGeo.cc.

References geodesicDistance().

Referenced by geodesicDistance(), and pathLength().

◆ interpolateAtDistance()

QGeoCoordinate QGCGeo::interpolateAtDistance ( const QGeoCoordinate &  from,
const QGeoCoordinate &  to,
double  distance 
)

Get the coordinate at a specific distance along a geodesic path using WGS84 ellipsoid.

Parameters
fromStarting coordinate.
toEnding coordinate.
distanceDistance from start in meters (clamped to path length).
Returns
Coordinate at the specified distance along the geodesic. Altitude is linearly interpolated.
Note
Useful for midpoint: interpolateAtDistance(from, to, geodesicDistance(from, to) / 2)

Definition at line 349 of file QGCGeo.cc.

References interpolateAtDistance().

Referenced by interpolateAtDistance().

◆ interpolatePath()

QList< QGeoCoordinate > QGCGeo::interpolatePath ( const QGeoCoordinate &  from,
const QGeoCoordinate &  to,
int  numPoints 
)

Interpolate evenly-spaced points along a geodesic path using WGS84 ellipsoid.

Parameters
fromStarting coordinate.
toEnding coordinate.
numPointsNumber of points to generate (must be >= 2).
Returns
List of coordinates including start and end points, evenly spaced along the geodesic.
Note
Uses GeodesicLine internally for efficiency. Altitude is linearly interpolated.

Definition at line 308 of file QGCGeo.cc.

References interpolatePath().

Referenced by interpolatePath().

◆ pathLength()

double QGCGeo::pathLength ( const QList< QGeoCoordinate > &  path)

Calculate total geodesic length of a path using WGS84 ellipsoid.

Parameters
pathList of coordinates defining the path.
Returns
Total path length in meters, or 0 if fewer than 2 points.

Definition at line 261 of file QGCGeo.cc.

References geodesicDistance(), and pathLength().

Referenced by pathLength().

◆ polygonArea()

double QGCGeo::polygonArea ( const QList< QGeoCoordinate > &  polygon)

Calculate geodesic area of a polygon using WGS84 ellipsoid.

Parameters
polygonList of coordinates defining the polygon vertices (automatically closed).
Returns
Absolute area in square meters, or 0 if fewer than 3 points.
Note
More accurate than planar projection methods, especially for large polygons.

Definition at line 274 of file QGCGeo.cc.

References polygonArea().

Referenced by polygonArea().

◆ polygonPerimeter()

double QGCGeo::polygonPerimeter ( const QList< QGeoCoordinate > &  polygon)

Calculate geodesic perimeter of a polygon using WGS84 ellipsoid.

Parameters
polygonList of coordinates defining the polygon vertices (automatically closed).
Returns
Perimeter in meters, or 0 if fewer than 2 points.

Definition at line 292 of file QGCGeo.cc.

References polygonPerimeter().

Referenced by polygonPerimeter().