Gmap Google Maps for the correction of the security algorithm

Source: Internet
Author: User

 /** * GPS correction algorithm for Google, the map of the German system * @author Administrator */class Function_gpscorrect {public stat        IC double pi = 3.14159265358979324;        public static Double A = 6378245.0;        public static Double ee = 0.00669342162296594323;            public static double[] transform (double Wglat, double Wglon) {double[] latlng = new double[2];                if (Outofchina (Wglat, Wglon)) {latlng[0] = Wglat;                LATLNG[1] = Wglon;            return null;            } Double Dlat = Transformlat (wgLon-105.0, wgLat-35.0);            Double Dlon = Transformlon (wgLon-105.0, wgLat-35.0);            Double Radlat = wglat/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);            Latlng[0] = Wglat + Dlat;            LATLNG[1] = Wglon + Dlon;        return latlng; } private static bool Outofchina (double lat, double lon) {if (Lon < 72.004 | | Lon > 137.83            ) return true;            if (Lat < 0.8293 | | lat > 55.8271) return true;        return false; } private static Double Transformlat (double x, double y) {double ret = -100.0 + 2.0 * x + 3.0 *            Y + 0.2 * y * y + 0.1 * x * y + 0.2 * math.sqrt (Math.Abs (x));            RET + = (20.0 * Math.sin (6.0 * x * pi) + 20.0 * Math.sin (2.0 * x * pi)) * 2.0/3.0;            RET + = (20.0 * Math.sin (y * pi) + 40.0 * Math.sin (y/3.0 * pi)) * 2.0/3.0;            RET + = (160.0 * Math.sin (y/12.0 * pi) + * * Math.sin (Y * pi/30.0)) * 2.0/3.0;        return ret; } private static Double Transformlon (double x, double y) {double ret = 300.0 + x + 2.0 *Y + 0.1 * x * x + 0.1 * x * y + 0.1 * MATH.SQRT (Math.Abs (x));            RET + = (20.0 * Math.sin (6.0 * x * pi) + 20.0 * Math.sin (2.0 * x * pi)) * 2.0/3.0;            RET + = (20.0 * Math.sin (x * pi) + 40.0 * Math.sin (x/3.0 * pi)) * 2.0/3.0;            RET + = (150.0 * Math.sin (x/12.0 * pi) + 300.0 * Math.sin (x/30.0 * pi)) * 2.0/3.0;        return ret; }    }

Originated from http://blog.csdn.net/junfeng120125/article/details/9966857

Gmap Google Maps for the correction of the security algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.