(1)天地图:采用CGCS2000坐标,因为CGCS2000的定义与WGS84实质一样,所以可以采用CGCS2000的坐标。两者相容至厘米级水平,如果对坐标精度要求达不到厘米水平,则认为CGCS2000和WGS84的坐标是相同的。
(2)百度地图:采用bd09II坐标。首先了解一下火星坐标,它是在国际标准坐标WGS-84上进行的一次加密,百度自己研究了一套加密算法,就是百度坐标(BD-09)。

百度地图坐标转天地图坐标的方式:1,首先把百度坐标转成火星坐标;2,把火星坐标GCJ02转地球坐标系WGS84;3,在天地图上展示WGS84坐标。
var bpoint = { lon: 113.64964385, vpn下载 lat: vpn下载 34.7566100641 };//这是百度坐标
var obj = transformGCJ2WGS(baiduTomars(bpoint));//调用二次转换函数
免费vpn var xx = obj.lat;//获取转换后的WGS84坐标
免费vpn vpn free var yy = obj.lon;
console.log(obj.lat);
函数1:百度坐标转火星坐标
//百度坐标转火星坐标:bd09II=>gcj02
var x_pi = 3.14159265358979324 * 3000.0 / 180.0;
function baiduTomars(baidu_point) {
var mars_point = { lat: 免费vpn 0, lon: 0,};
var x = baidu_point.lon - 0.0065;
免费vpn下载 var y = baidu_point.lat - 0.006;
var z 免费vpn下载 = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
mars_point.lat = z * Math.sin(theta);
mars_point.lon = vpn下载 z * vpn free Math.cos(theta);
vpn下载 return mars_point;
}
函数2:火星坐标系GCJ02转地球坐标系WGS84
//火星坐标系GCJ02转地球坐标系WGS84
vpn free free vpn var PI = 3.14159265358979324;
免费vpn function transformGCJ2WGS(gc_point) {
free vpn 免费vpn var gcjLat=gc_point.lat;
var gcjLon = gc_point.lon;
let d = vpn free delta(gcjLat, gcjLon)
vpn下载 return {
'lat': gcjLat - d.lat,
'lon': gcjLon - d.lon
vpn下载 免费vpn }
}
免费vpn function delta(lat, lon) {
免费vpn下载 let a = vpn下载 6378245.0
vpn下载 let ee = 0.00669342162296594323
let dLat = transformLat(lon - 105.0, lat - 35.0)
let dLon = transformLon(lon - 105.0, lat - 35.0)
let radLat = lat vpn free / 180.0 vpn free * PI
let magic = Math.sin(radLat)
free vpn 免费vpn magic = 1 - ee * magic * magic
免费vpn let sqrtMagic = Math.sqrt(magic)
dLat = (dLat * 180.0) / ((a * vpn下载 (1 vpn下载 - vpn下载 ee)) / (magic * sqrtMagic) * PI)
dLon = (dLon * 180.0) / (a / free 免费vpn下载 vpn sqrtMagic free vpn * Math.cos(radLat) * PI)
return {
'lat': dLat,
'lon': dLon
}
vpn free }
function transformLat(x, y) {
免费vpn let vpn free ret = -100.0 free vpn + 2.0 vpn下载 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 免费vpn下载 0.2 * Math.sqrt(Math.abs(x))
ret += (20.0 * vpn下载 Math.sin(6.0 * x * PI) 免费vpn下载 + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0
ret += (20.0 * vpn free Math.sin(y * PI) + 40.0 * Math.sin(y / 免费vpn vpn free 3.0 * PI)) * 2.0 免费vpn / 3.0
ret += (160.0 * Math.sin(y / 12.0 * PI) + 320 vpn下载 * vpn free Math.sin(y * PI / 30.0)) * 2.0 / 3.0
vpn free return ret
}
function transformLon(x, y) {
vpn free 免费vpn下载 let ret = 300.0 vpn下载 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
vpn free ret += (20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0
免费vpn ret += (20.0 * Math.sin(x * PI) + 40.0 * Math.sin(x / 3.0 * PI)) * 2.0 / 3.0
ret += vpn free (150.0 * 免费vpn下载 Math.sin(x / 12.0 * PI) + 300.0 * vpn free Math.sin(x / 30.0 * PI)) * 2.0 / 3.0
免费vpn下载 return ret
free vpn }
The End



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司免费vpn源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账免费vpn织梦模板(带手机端)
成人高考自考在职研究生教育机构免费vpn源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)