[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. Data structures and algorithms

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.1 Observation data and points

The Gama observation data structures are designed to enable adjustment of any combination of possibly correlated observations. At its very early stage Gama was limited to adjustment of uncorrelated observations. Only directions and distances were available and observable’s weight was stored together with the observed value in a single object. A single array of pointers to observation objects was sufficient for handling all observations. So called orientation shifts corresponding to directions measured form a point were stored together with coordinations in point objects.


To enable adjustment of possibly correlated observations (like angles derived from observed directions or already adjusted coordinates from a previous adjustment) Gama has come with the concept of clusters. Cluster is an object with a common variance-covariance matrix and a list of pointers to observation objects (distances, directions, angles, etc.). Weights were removed from observation objects and replaced with a pointer to the cluster to which the observation belong. All clusters are joined in a common object ObservationData; similarly to observations, each cluster contains a pointer to its parent Observation Data object. Orientation shifts were separated from coordinates and are stored in the cluster containing the bunch of directions and thus number of orientations is not limited to one for a point.

This organisation of observational information has proved to be effective. Template classes ObservationData and Cluster are used as base classes both in gama-local and gama-g3

template <typename Observation>
  class ObservationData
    ClusterList<Observation>  CL;
    ObservationData(const ObservationData& cod);
    ObservationData& operator=(const ObservationData& cod);   
    template <typename P> void for_each(const P& p) const;

template <typename Observation>  
  class Cluster 
    const ObservationData<Observation>*     observation_data;
    ObservationList<Observation>            observation_list;
    typename Observation::CovarianceMatrix  covariance_matrix;  
    Cluster(const ObservationData<Observation>* od);
    virtual ~Cluster();
    virtual Cluster* clone(const ObservationData<Observation>*) const = 0;
    double stdDev(int i) const;
    int size() const;
    void update();
    int  activeCount() const;
    typename Observation::CovarianceMatrix activeCov() const; 

The following template class PointBase for handling point information is used in gama-g3. The template class PointBase relies internally on std::map container but comes with its own interface (in gama-local std::map was used directly for storing points).

template <typename Point>
  class PointBase
    typedef std::map<typename Point::Name, Point*>  Points;

    PointBase(const PointBase& cod);
    PointBase& operator=(const PointBase& cod);
    void put(const Point&);
    void put(Point*);
    Point*       find(const typename Point::Name&);
    const Point* find(const typename Point::Name&) const;
    void erase(const typename Point::Name&);
    void erase();
    class const_iterator;
    const_iterator  begin();
    const_iterator  end  ();

    class iterator;
    iterator  begin();
    iterator  end  ();

Template classes ObservationData and PointBase are defined in namespace GNU_gama and are located in the source directory gnu_gama.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2 Supported ellipsoids

idab, 1/f, fdescription
airy6377563.3966356256.910Airy ellipsoid 1830[4]
airy_mod6377340.1896356034.446Modified Airy[4]
apl19656378137298.25Appl. Physics. 1965[4]
andrae18766377104.43300.0Andrae 1876 (Denmark, Iceland)[4]
australian6378160298.25Australian National 1965[3]
bessel6377397.155086356078.96290Bessel ellipsoid 1841[1]
bessel_nam6377483.865299.1528128Bessel 1841 (Namibia)[4]
clarke1858a63783616356685Clarke ellipsoid 1858 1st[3]
clarke1858b63785586355810Clarke ellipsoid 1858 2nd[3]
clarke18666378206.46356583.8Clarke ellipsoid 1866[3]
clarke188063783166356582Clarke ellipsoid 1880[3]
clarke1880m6378249.145293.4663Clarke ellipsoid 1880 (modified)[4]
cpm17996375738.7334.29Comm. des Poids et Mesures 1799[4]
delambre6376428311.5Delambre 1810 (Belgium)[4]
engelis6378136.05298.2566Engelis 1985[4]
everest18306377276.345300.8017Everest 1830[4]
everest18486377304.063300.8017Everest 1948[4]
everest18566377301.243300.8017Everest 1956[4]
everest18696377295.664300.8017Everest 1969[4]
everest_ss6377298.556300.8017Everest (Sabah and Sarawak)[4]
fisher19606378166298.3Fisher 1960 (Mercury Datum)[3] [4]
fisher1960m6378155298.3Modified Fisher 1960[3] [4]
fischer19686378150298.3Fischer 1968[4]
grs676378160298.2471674270GRS 67 (IUGG 1967)[4]
grs806378137298.257222101Geodetic Reference System 1980[1]
hayford6378388297Hayford 1909 (International)[1] [3]
helmert6378200298.3Helmert ellipsoid 1906[3]
iau766378140298.257IAU 1976[4]
international6378388297International 1924 (Hayford 1909)[1] [3]
kaula6378163298.24Kaula 1961[4]
krassovski6378245298.3Krassovski ellipsoid 1940[1]
lerch6378139298.257Lerch 1979[4]
mprts6397300191.0Maupertius 1738[4]
mercury6378166298.3Mercury spheroid 1960[3]
merit6378137298.257MERIT 1983[4]
new_intl6378157.56356772.2New International 1967[4]
nwl19656378145298.25Naval Weapons Lab., 1965[4]
plessis63765236355863Plessis 1817 (France)[4]
se_asia63781556356773.3205Southeast Asia[4]
sgs856378136298.257Soviet Geodetic System 85[4]
schott6378157304.5Schott 1900 spheroid[3]
sa19696378160298.25South American Spheroid 1969[3]
wgs606378165298.3WGS 60[4]
wgs666378145298.25WGS 66[4]
wgs726378135298.26WGS 72[4]
wgs846378137298.257223563World Geodetic System 1984[1]
[1]Milos Cimbalnik - Leos Mervart: Vyssi geodezie 1, 1997, Vydavatelstvi CVUT, Praha
[2]Milos Cimbalnik: Derived Geometrical Constants of the Geodetic Reference System 1980, Studia geoph. et geod. 35 (1991), pp. 133-144, NCSAV, Praha
[3]Glossary of the Mapping Sciences, Prepared by a Joint Committe of the American Society of Civil Engineers, American Congress on Surveying and Mapping and American Society for Photogrammetry and Remote Sensing (1994), USA, ISBN 1-57083-011-8, ISBN 0-7844-0050-4
[4]Gerald Evenden: proj - forward cartographic projection filter (rel. 4.3.3), http://www.remotesensing.org/proj

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.3 Transformation from spatial to geographical coordinates

Spatial coordinates (X, Y, Z) can be easily computed from geographical ellipsoidal coordinates (B, L, H), where B is geographical latitude, L geographical longitude and H is elliposidal height, as

X = (N + H) cos B cos L
Y = (N + H) cos B sin L
Z = (N(1-e^2) + H)sin B

where N = a/sqrt(1 - e^2 sin^2 B) is the radius of curvature in the prime vertical, e^2 = (a^2 - b^2)/a^2 is the first eccentricity for the given rotational ellipsoid (spheroid) with semi-major axis a and semi-minor axis b.

In the case of coordiante transformation from (X, Y, Z) to (B, L, H), the longitude is given by the formula

tan L = Y / X.

Now we can introduce

D = sqrt(X^2 + Y^2),

so that the cartesian system become (D, Z). Coordinates B and H are then usually computed by iteration with some starting value of B_0, for example

tan B_0 = Z/D/(1 - e^2),
tan B = Z/D + N/(N+H) e^2 tan B,   H  = D / cos B = Z / sin B - N(1-e^2)

B. R. Bowring described a closed formula(2) that is more effective and sufficiantly accurate and that is used in GNU Gama.


The centre of curvature C of the spheroid corresponding to P’ is the point

(e^2 a cos^3 u, -e’^2 b sin^3 u)),

where e’^2 = (a^2 - b^2)/b^2 is second eccentricity and u is the parametric latitude of the point P’, (1-e^2)N sin B = b sin u. Therefore

tan B = (Z + e’^2 b sin^3 u) / (D - e^2 a cos^3 u).

This is clearly an iterative solution; but it has been found that this formula is extremely accurate using the single first approximation for u for the tan u = (Z/D)(a/b). Maximum error in earth bound region is 3e-8 of sexadecimal arc seconds (5e-7 millimetres); maximum is 0.0018” (0.1 millimetres) at height H = 2a.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.4 Class g3::Model

g3::model documentation shall come here ...

namespace GNU_gama {  namespace g3 {

  class Model {
    typedef GNU_gama::PointBase<g3::Point>              PointBase;
    typedef GNU_gama::ObservationData<g3::Observation>  ObservationData;
    PointBase           *points;
    ObservationData     *obs;
    GNU_gama::Ellipsoid  ellipsoid;


    Point* get_point(const Point::Name&);
    void   write_xml(std::ostream& out) const;
    void   pre_linearization();

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Ales Cepek on May 13, 2018 using texi2html 1.82.