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).

Template plh2xyzVec {        unit` rowset;` `    `[`attribute`](attribute "wikilink")` lat (rowset);` `    `[`attribute`](attribute "wikilink")` lon (rowset);` `       ` `    `[`parameter`](parameter "wikilink")` a          := 6378137.0;             // WGS84 equatorial radius` `    `[`parameter`](parameter "wikilink")` f          := 1.0 / 298.257223563;   // Earth flattening` `    `[`parameter`](parameter "wikilink")` e2         := 2.0 * f - f * f;       // excentricity e (squared)` `    `[`attribute`](attribute "wikilink")` N (rowset) := a / `[`sqrt`](sqrt "wikilink")`(1.0-e2 * `[`sqr`](sqr "wikilink")`(`[`sin`](sin "wikilink")`(lat*`[`pi`](pi "wikilink")`()/180.0))); // Kromtestraal Oost-West richting` `       ` `    `[`attribute`](attribute "wikilink")` X (rowset) := N * `[`cos`](cos "wikilink")`(lat*`[`pi`](pi "wikilink")`()/180.0) * `[`cos`](cos "wikilink")`(lon*`[`pi`](pi "wikilink")`()/180.0);` `    `[`attribute`](attribute "wikilink")` Y (rowset) := N * `[`cos`](cos "wikilink")`(lat*`[`pi`](pi "wikilink")`()/180.0) * `[`sin`](sin "wikilink")`(lon*`[`pi`](pi "wikilink")`()/180.0);` `    `[`attribute`](attribute "wikilink")` Z (rowset) := (N-e2*N)*`[`sin`](sin "wikilink")`(lat * `[`pi`](pi "wikilink")`()/180.0);` `}`

Template plh2xyzParam {     parameter` lat;` `    `[`parameter`](parameter "wikilink")` lon;` `       ` `    `[`parameter`](parameter "wikilink")` a  := 6378137.0;             // WGS84 equatorial radius` `    `[`parameter`](parameter "wikilink")` f  := 1.0 / 298.257223563;   // Earth flattening` `    `[`parameter`](parameter "wikilink")` e2 := 2.0 * f - f * f;       // excentricity e (squared)` `    `[`parameter`](parameter "wikilink")` N  := a / `[`sqrt`](sqrt "wikilink")`(1.0-e2 * `[`sqr`](sqr "wikilink")`(`[`sin`](sin "wikilink")`(lat*`[`pi`](pi "wikilink")`()/180.0))); // Kromtestraal Oost-West richting` `       ` `    `[`parameter`](parameter "wikilink")` X  := N * `[`cos`](cos "wikilink")`(lat*`[`pi`](pi "wikilink")`()/180.0) * `[`cos`](cos "wikilink")`(lon*`[`pi`](pi "wikilink")`()/180.0);` `    `[`parameter`](parameter "wikilink")` Y  := N * `[`cos`](cos "wikilink")`(lat*`[`pi`](pi "wikilink")`()/180.0) * `[`sin`](sin "wikilink")`(lon*`[`pi`](pi "wikilink")`()/180.0);` `    `[`parameter`](parameter "wikilink")` Z  := (N-e2*N)*`[`sin`](sin "wikilink")`(lat * `[`pi`](pi "wikilink")`()/180.0);` `}`

Template Haversine {        parameter` lat1_degrees: isHidden="True";` `       `[`parameter`](parameter "wikilink")` lat2_degrees;` `       `[`parameter`](parameter "wikilink")` lon1_degrees;` `       `[`parameter`](parameter "wikilink")` lon2_degrees;` `       `[`parameter`](parameter "wikilink")` lat1_radian := lat1_degrees * pi() / 180.0;` `       `[`parameter`](parameter "wikilink")` lat2_radian := lat2_degrees * pi() / 180.0;` `       `[`parameter`](parameter "wikilink")` lon1_radian := lon1_degrees * pi() / 180.0;` `       `[`parameter`](parameter "wikilink")` lon2_radian := lon2_degrees * pi() / 180.0;` `       `[`parameter`](parameter "wikilink")`     deltaLon_radian := lon1_radian - lon2_radian;` `       `[`parameter`](parameter "wikilink")`     deltaLat_radian := lat1_radian - lat2_radian;` `       `[`parameter`](parameter "wikilink")`     a               := sqr(sin(deltaLat_radian/2d)) + (((cos(lat1_radian) * cos(lat2_radian))) * sqr(sin(deltaLon_radian/2d)));` `       `[`parameter`](parameter "wikilink")`          distance        := (2d * 6371d * atan(sqrt(a) / (sqrt(1d - a))))[km];` `}`