<?php echo<<<_END <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> <title>点标记</title> <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/> <style> .marker { color: #ff6600; padding: 4px 10px; border: 1px solid #fff; white-space: nowrap; font-size: 12px; font-family: ""; background-color: #0066ff; } </style> <script src="http://webapi.amap.com/maps?v=1.3&key=0f1171e4ad3be633777884f63d562b12"></script> </head> <body> <div id="container"></div> <script> var GPS = { PI : 3.14159265358979324, x_pi : 3.14159265358979324 * 3000.0 / 180.0, delta : function (lat, lon) { // Krasovsky 1940 // // a = 6378245.0, 1/f = 298.3 // b = a * (1 - f) // ee = (a^2 - b^2) / a^2; var a = 6378245.0; // a: 卫星椭球坐标投影到平面地图坐标系的投影因子。 var ee = 0.00669342162296594323; // ee: 椭球的偏心率。 var dLat = this.transformLat(lon - 105.0, lat - 35.0); var dLon = this.transformLon(lon - 105.0, lat - 35.0); var radLat = lat / 180.0 * this.PI; var magic = Math.sin(radLat); magic = 1 - ee * magic * magic; var sqrtMagic = Math.sqrt(magic); dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * this.PI); dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * this.PI); return {'lat': dLat, 'lon': dLon}; }, //WGS-84 to GCJ-02 gcj_encrypt : func
用自定义的函数将gps转换为高德坐标
最新推荐文章于 2021-10-12 11:41:12 发布