Ejemplo n.º 1
0
        private static ConvertBing transform(double lat, double lon)
        {
            ConvertBing info = new ConvertBing();

            if (outOfChina(lat, lon))
            {
                info.setChina(false);
                info.setLatitude(lat);
                info.setLongitude(lon);
                return(info);
            }
            double dLat   = transformLat(lon - 105.0, lat - 35.0);
            double dLon   = transformLon(lon - 105.0, lat - 35.0);
            double radLat = lat / 180.0 * pi;
            double magic  = Math.Sin(radLat);

            magic = 1 - ee * magic * magic;
            double sqrtMagic = Math.Sqrt(magic);

            dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
            dLon = (dLon * 180.0) / (a / sqrtMagic * Math.Cos(radLat) * pi);
            double mgLat = lat + dLat;
            double mgLon = lon + dLon;

            info.setChina(true);
            info.setLatitude(mgLat);
            info.setLongitude(mgLon);

            return(info);
        }
Ejemplo n.º 2
0
        public static ConvertBing gcj02_To_Wgs84(double lat, double lon)
        {
            ConvertBing info      = new ConvertBing();
            ConvertBing gps       = transform(lat, lon);
            double      lontitude = lon * 2 - gps.getLongitude();
            double      latitude  = lat * 2 - gps.getLatitude();

            info.setChina(gps.IsChina());
            info.setLatitude(latitude);
            info.setLongitude(lontitude);
            return(info);
        }