Exemple #1
0
 public static Vector3Double GeodeticToDatabase(GeodeticCoord geod)
 {
     return(new Vector3Double(
                (((geod.Lon - _refLatLon.Lon)) * (flat_earth_radius * PI * Cos(DegreesToRadians(_refLatLon.Lat)))) / 180.0,
                geod.Alt,
                ((geod.Lat - _refLatLon.Lat) * (flat_earth_radius * PI)) / 180.0
                ));
 }
Exemple #2
0
        public static GeocentricCoord GeodeticToGeocentric(GeodeticCoord geod)
        {
            var lambda = DegreesToRadians(geod.Lat);
            var phi    = DegreesToRadians(geod.Lon);
            var s      = Sin(lambda);
            var N      = a / Sqrt(1 - e_sq * s * s);

            var sin_lambda = Sin(lambda);
            var cos_lambda = Cos(lambda);
            var cos_phi    = Cos(phi);
            var sin_phi    = Sin(phi);

            return(new GeocentricCoord(
                       (geod.Alt + N) * cos_lambda * cos_phi,
                       (geod.Alt + N) * cos_lambda * sin_phi,
                       (geod.Alt + (1 - e_sq) * N) * sin_lambda
                       ));
        }
Exemple #3
0
        public static UTMCoord GeodToUTM(GeodeticCoord geod)
        {
            UTMCoord utm;

            utm.Zone = (int)Floor((geod.Lon + 180.0) / 6) + 1;

            MapLatLonToXY(DegreesToRadians(geod.Lat), DegreesToRadians(geod.Lon), UTMCentralMeridian(utm.Zone), out utm.X, out utm.Y);

            /* Adjust easting and northing for UTM system. */
            utm.X = utm.X * utm_scale_factor + 500000.0;
            utm.Y = utm.Y * utm_scale_factor;
            if (utm.Y < 0.0)
            {
                utm.Y = utm.Y + 10000000.0;
            }

            utm.IsNorthHemisphere = geod.Lat >= 0;

            utm.Z = geod.Alt;

            return(utm);
        }