当前位置:网站首页>大地坐标系转换火星坐标系
大地坐标系转换火星坐标系
2022-07-28 15:22:00 【孙奋斗】
WGS84:国际坐标系,为一种大地坐标系,也是目前广泛使用的GPS全球卫星定位系统使用的坐标系。
GCJ02:火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。
BD09:为百度坐标系,在GCJ02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标
上代码
const x_PI = 52.35987755982988;
const PI = 3.1415926535897932384626;
const a = 6378245.0;
const ee = 0.00669342162296594323;
public function wgs84togcj02($lng, $lat) {
//if ($this->out_of_china($lng, $lat)) {
// return array($lng, $lat);
// } else {
$dlat = $this->transformlat($lng - 105.0, $lat - 35.0);
$dlng = $this->transformlng($lng - 105.0, $lat - 35.0);
$radlat = $lat / 180.0 * self::PI;
$magic = sin($radlat);
$magic = 1 - self::ee * $magic * $magic;
$sqrtmagic = sqrt($magic);
$dlat = ($dlat * 180.0) / ((self::a * (1 - self::ee)) / ($magic * $sqrtmagic) * self::PI);
$dlng = ($dlng * 180.0) / (self::a / $sqrtmagic * cos($radlat) * self::PI);
$mglat = $lat + $dlat;
$mglng = $lng + $dlng;
dump($mglng.','.$mglat);//转换后得经纬度
// }
}
private function transformlat($lng, $lat) {
$ret = -100.0 + 2.0 * $lng + 3.0 * $lat + 0.2 * $lat * $lat + 0.1 * $lng * $lat + 0.2 * sqrt(abs($lng));
$ret += (20.0 * sin(6.0 * $lng * self::PI) + 20.0 * sin(2.0 * $lng * self::PI)) * 2.0 / 3.0;
$ret += (20.0 * sin($lat * self::PI) + 40.0 * sin($lat / 3.0 * self::PI)) * 2.0 / 3.0;
$ret += (160.0 * sin($lat / 12.0 * self::PI) + 320 * sin($lat * self::PI / 30.0)) * 2.0 / 3.0;
return $ret;
}
private function transformlng($lng, $lat) {
$ret = 300.0 + $lng + 2.0 * $lat + 0.1 * $lng * $lng + 0.1 * $lng * $lat + 0.1 * sqrt(abs($lng));
$ret += (20.0 * sin(6.0 * $lng * self::PI) + 20.0 * sin(2.0 * $lng * self::PI)) * 2.0 / 3.0;
$ret += (20.0 * sin($lng * self::PI) + 40.0 * sin($lng / 3.0 * self::PI)) * 2.0 / 3.0;
$ret += (150.0 * sin($lng / 12.0 * self::PI) + 300.0 * sin($lng / 30.0 * self::PI)) * 2.0 / 3.0;
return $ret;
}
边栏推荐
- 跳表的实现
- I'll show you a little chat! Summary of single merchant function modules
- PHP mb_substr 中文乱码
- flashfxp 530 User cannot log in. ftp
- js 队列
- 使用js直传oss阿里云存储文件,解决大文件上传服务器限制
- R language uses file of FS package_ Delete function deletes the specified file under the specified folder, draw inferences from one instance, dir_ Delete function, link_ The delete function can be use
- Let's learn the game of beating hamsters
- 兆骑科创创新创业大赛人才引进平台,双创赛事高层次人才引进
- mysql查询 limit 1000,10 和limit 10 速度一样快吗?如果我要分页,我该怎么办?
猜你喜欢

振弦采集模块测量振弦传感器的流程步骤?

Stm32cube infrared remote control: input capture

Application of optical rain gauge to rainfall detection

A tour of grp:05 - GRP server streaming service end stream

Common problems and precautions of remote serial port server (adapter) uart/i2c/1-wire/spi PS304

The epidemic dividend disappeared, and the "home fitness" foam dissipated

laravel

SCI scientific paper writing Growth Camp (full version)

激光测距仪非接触式地表裂缝监测仪

一大早支付宝来短信说你中“奖”了?处理服务器挖矿病毒 - kthreaddi
随机推荐
Zhengda cup hacker marathon data analysis competition
Stm32cube infrared remote control: input capture
JS linked list 02
食品安全 | 这两类瓜果宜改善便秘 孕妇人群尤其建议
五舅的思考
使用js直传oss阿里云存储文件,解决大文件上传服务器限制
2021 Kent interview question 2
leetcode 题目
Rust 入门指南(crate 管理)
KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书
加速投资的小红书,“病急乱投医”?
JS bidirectional linked list 01
小程序中的分页查询
Two special functions (arrow function and method)
Let's learn the game of beating hamsters
js中的for循环总结
Installation points and precautions of split angle probe
js 队列
两种特殊函数(箭头函数和方法)
百度编辑器ueditor,编辑内容过多时,工具栏不可见,不方便编辑或上传问题