当前位置:网站首页>大地坐标系转换火星坐标系
大地坐标系转换火星坐标系
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;
}
边栏推荐
- Ethernet to RS485 serial port counter WiFi module LED light controller ibf165
- LwIP development | socket | DNS domain name resolution
- Paging query in applet
- I'll show you a little chat! Summary of single merchant function modules
- Baidu editor ueeditor, when editing too much content, the toolbar is not visible, which is not convenient for editing or uploading problems
- A tour of grp:05 - GRP server streaming service end stream
- 高精度绝对角度传感器应用高速度角度监测
- I came across Digital Phoenix coordinate Xuhui Meiluo city in Shanghai
- LwIP development | socket | TCP | client
- 深入理解Istio流量管理的熔断配置
猜你喜欢

一大早支付宝来短信说你中“奖”了?处理服务器挖矿病毒 - kthreaddi

The video Number finds the golden key, and Tiktok imitates the latecomers

mysql 查看事件状态语句和修改办法

远距离串口服务器( 适配器)UART 转 1-Wire 应用

JS linked list 02

Voltage to current / current to voltage module

laravel

Dynamic programming -- digital statistics DP

500million users, four years earlier than wechat... This app, which has been in operation for 15 years, will be permanently discontinued

小程序中的分页查询
随机推荐
LabVIEW LINX Toolkit控制Arduino设备(拓展篇—1)
Temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)
leetcode 题目
仅需三步 轻松实现远程办公
VM501开发套件开发版单振弦式传感器采集模块岩土工程监测
Reentrant and non reentrant
远距离串口服务器( 适配器)UART/I2C/1-Wire/SPI PS304常见问题及注意事项
Note: the value is rounded up to ten, hundred, thousand, ten thousand
js中的for循环总结
Deeply understand the fusing configuration of istio traffic management
I came across Digital Phoenix coordinate Xuhui Meiluo city in Shanghai
js 队列
mysql 查看事件状态语句和修改办法
Telecommuting can be easily realized in only three steps
资本「断供」两年,我只能把公司卖了
laravel
魏建军骑宝马也追不上李书福
5 亿用户,比微信还早四年……这个运营了 15 年的 APP 即将永久停服
IT远程运维是什么意思?远程运维软件哪个好?
Numpy ndarray learning < II > miscellaneous records