private static void ShiftFromWGS84(ref Sellips el_WGS84, ref Sellips da_out, ref Sellips el_out, ref double Lon, ref double Lat, ref double H) { double da = el_out.A - el_WGS84.A; double df = el_out.C - el_WGS84.C; double out_Lat = 0.0, out_Lon = 0.0, out_Hgt = 0.0; MolodenskyShift(el_out.A, da, el_out.C, df, -da_out.A, -da_out.B, -da_out.C, Lat, Lon, H, ref out_Lat, ref out_Lon, ref out_Hgt); Lon = out_Lon; Lat = out_Lat; H = out_Hgt; }
//public static Coordinate Wgs84ToPulkovo42(Coordinate c, int zoneNumber) //{ // if (c.System != @"WGS-84") // throw new InvalidOperationException("Coordinate must be in WGS-84 system!"); // double lat = c.Lat * Deg2Rad; // double lon = c.Long * Deg2Rad; // double hei = c.Height; // WGS84ToPulkovo42(ref lat, ref lon, ref hei); // Coordinate work = new Coordinate("Pulkovo-42"); // work.Lat = c.Lat;// lat / magicNumber; // work.Long = c.Long;// lon / magicNumber; // work.Height = hei; // S_TransMercator Par_gauss = new S_TransMercator(); // Par_gauss.CentralMeridian = 0; // Par_gauss.OriginLatitude = 0; // Par_gauss.ScaleFactor = 1; // Par_gauss.North = 0; // Par_gauss.East = 500000; // Par_gauss.Auto = true; // S_TransMercator proj_par = Par_gauss; // proj_par.CentralMeridian = (zoneNumber * 6.0 - 3.0) * Deg2Rad; // proj_par.East = proj_par.East + zoneNumber * 1000000.0; // Project_TMR(ref proj_par, ref lat, ref lon); // work.X = lon; // work.Y = lat; // work.Alt = hei; // return work; //} //public static Coordinate Wgs84ToUTM(Coordinate coordinate) //{ // if (coordinate.System != @"WGS-84") // throw new InvalidOperationException("Coordinate must be in WGS-84 system!"); // double utmNorthing; // double utmEasting; // string utmZone; // LatLongToUTM(23, coordinate.Lat, coordinate.Long, out utmNorthing, out utmEasting, out utmZone); // return new Coordinate(@"UTM") { Alt = coordinate.Height, Height = coordinate.Height, Lat = coordinate.Lat, Long = coordinate.Long, X = utmEasting, Y = utmNorthing }; //} #region Private private static void WGS84ToPulkovo42(ref double lat, ref double lon, ref double hei) { Sellips el_WGS84 = new Sellips(), da_out = new Sellips(), el_out = new Sellips(); el_WGS84.A = 6378137; el_WGS84.B = 6356752.3142; el_WGS84.C = 1.0 / 298.257223563; el_out.A = 6378245; el_out.B = 6356863.019; el_out.C = 1.0 / 298.3; da_out.A = 28; da_out.B = -130; da_out.C = -95; ShiftFromWGS84(ref el_WGS84, ref da_out, ref el_out, ref lon, ref lat, ref hei); }