-
Notifications
You must be signed in to change notification settings - Fork 1
Geodetic Templates
This page provides a list of GeoDMS Template implementations with common geodetic operations, such as conversion between geodetic coordinate and datum systems (ie: spherical [longitude, latitude, height] to WGS84 ECEF [X, Y, Z] frame).
'''cpp Template plh2xyzVec { unit rowset; attribute lat (rowset); attribute lon (rowset); parameter a := 6378137.0; // WGS84 equatorial radius parameter f := 1.0 / 298.257223563; // Earth flattening parameter e2 := 2.0 * f - f * f; // excentricity e (squared) attribute N (rowset) := a / sqrt (1.0-e2 * [sqr]); // Kromtestraal Oost-West richting attribute X (rowset) := N * [cos] * [cos]; attribute Y (rowset) := N * cos (lat*[pi]/180.0) * sin (lon*[pi]/180.0); attribute Z (rowset) := (N-e2N)sin (lat * [pi]/180.0); } '''
[[Template]] plh2xyzParam
{
[[parameter]] <float64> lat;
[[parameter]] <float64> lon;
[[parameter]] <float64> a := 6378137.0; // WGS84 equatorial radius
[[parameter]] <float64> f := 1.0 / 298.257223563; // Earth flattening
[[parameter]] <float64> e2 := 2.0 * f - f * f; // excentricity e (squared)
[[parameter]] <float64> N := a / [[sqrt]](1.0-e2 * [[sqr]]([[sin]](lat*[[pi]]()/180.0))); // Kromtestraal Oost-West richting
[[parameter]] <float64> X := N * [[cos]](lat*[[pi]]()/180.0) * [[cos]](lon*[[pi]]()/180.0);
[[parameter]] <float64> Y := N * [[cos]](lat*[[pi]]()/180.0) * [[sin]](lon*[[pi]]()/180.0);
[[parameter]] <float64> Z := (N-e2*N)*[[sin]](lat * [[pi]]()/180.0);
}[[Template]] Haversine
{
[[parameter]] <float64> lat1_degrees: isHidden="True";
[[parameter]] <float64> lat2_degrees;
[[parameter]] <float64> lon1_degrees;
[[parameter]] <float64> lon2_degrees;
[[parameter]] <float64> lat1_radian := lat1_degrees * pi() / 180.0;
[[parameter]] <float64> lat2_radian := lat2_degrees * pi() / 180.0;
[[parameter]] <float64> lon1_radian := lon1_degrees * pi() / 180.0;
[[parameter]] <float64> lon2_radian := lon2_degrees * pi() / 180.0;
[[parameter]] <float64> deltaLon_radian := lon1_radian - lon2_radian;
[[parameter]] <float64> deltaLat_radian := lat1_radian - lat2_radian;
[[parameter]] <float64> a := sqr(sin(deltaLat_radian/2d)) + (((cos(lat1_radian) * cos(lat2_radian))) * sqr(sin(deltaLon_radian/2d)));
[[parameter]] <km> distance := (2d * 6371d * atan(sqrt(a) / (sqrt(1d - a))))[km];
}GeoDMS ©Object Vision BV. Source code distributed under GNU GPL-3. Documentation distributed under CC BY-SA 4.0.