コード例 #1
0
        public ge_data WGS84_Lat_Long_Height_to_OSGB_East_North(ge_data _wg84)
        {
            // Step 1 Convert WGS84 Latitude, longitude and Ellipsoidal height to WGS84 Cartesian XYZ

            wg84 = _wg84;

            ge_projectionWGS84 pwg84 = new ge_projectionWGS84(wg84);

            if (!pwg84.calcXYZ_fromLatLong())
            {
                errorMsg = "Error pwg84.calcXYZ_fromLatLong()";
                return(null);
            }
            ;


            // Step 2 Apply Helmert Datum Transformation (WGS84 to OSGB36)

            ge_projection_transform t  = new WGS84_to_OSGB();
            HelmertTransform        ht = new HelmertTransform(t);
            ge_coords wg84_coords      = new ge_coords(wg84);
            ge_coords osgb_coords      = ht.Transform(wg84_coords);

            // Step 3 Convert OSGB36 Cartesian XYZ to OSGB36 Latitude, longitude and approx ODN height

            osg36      = new ge_data();
            osg36.locX = osgb_coords.coord_x;
            osg36.locY = osgb_coords.coord_y;
            osg36.locZ = osgb_coords.coord_z;

            ge_projectionOSGB36 posgb36 = new ge_projectionOSGB36(osg36);

            if (!posgb36.calcLatLongH_fromXYZ())
            {
                errorMsg = "Error posgb36.calcLatLongH_fromXYZ()";
                return(null);
            }
            ;

            // Step 4 Convert OSGB36 Latitude and longitude to OSGB36 easting and northing

            if (!posgb36.calcEN_fromLatLong())
            {
                errorMsg = "Error posgb36.calcEN_fromLatLong()";
                return(null);
            }

            return(osg36);
        }
コード例 #2
0
        public ge_data OSGB_East_North_to_WGS84_Lat_Long_Height(ge_data _osg36)
        {
            ge_data wg84 = new ge_data();

            // Step 1 Convert OSGB36 easting, northing and height to OSGB36 latitude and longitude

            osg36 = _osg36;

            ge_projectionOSGB36 posgb36 = new ge_projectionOSGB36(osg36);

            if (!posgb36.calcLatLong_fromEN())
            {
                errorMsg = "Error: posgb36.calcLatLong_fromEN()";
                return(null);
            }

            // Step 2 Convert OSGB36 latitude, longitude and approx ODN height to OSGB36 cartesian XYZ

            if (!posgb36.calcXYZ_fromLatLong())
            {
                errorMsg = "Error: posgb36.calcXYZ_fromLatLong()";
                return(null);
            }

            // Step 3 Apply Helmert Datum Transformation (OSGB36 to WGS84)
            ge_projection_transform t  = new OSGB_to_WGS84();
            HelmertTransform        ht = new HelmertTransform(t);
            ge_coords osg36_coords     = new ge_coords(osg36);
            ge_coords wg84_coords      = ht.Transform(osg36_coords);

            wg84.locX = wg84_coords.coord_x;
            wg84.locY = wg84_coords.coord_y;
            wg84.locZ = wg84_coords.coord_z;

            // Step Convert WGS84 Cartesian XYZ to WGS84 Latitude, longitude and Ellipsoidal height

            ge_projectionWGS84 pwg84 = new ge_projectionWGS84(wg84);

            if (!pwg84.calcLatLongH_fromXYZ())
            {
                errorMsg = "Error: pwg84.calcLatLongH_fromXYZ()";
                return(null);
            }
            ;

            return(wg84);
        }