当前位置:网站首页>Geodetic coordinate system to Martian coordinate system
Geodetic coordinate system to Martian coordinate system
2022-07-28 16:27:00 【Sun Fendou】
WGS84: International coordinate system , For a geodetic coordinate system , It is also widely used at present GPS The coordinate system used by GPS .
GCJ02: Mars coordinate system , It is the coordinate system of geographic information system developed by China National Bureau of Surveying and mapping . from WGS84 The encrypted coordinate system .
BD09: For Baidu coordinate system , stay GCJ02 The coordinate system is encrypted again . among bd09ll Represents Baidu latitude and longitude coordinates ,bd09mc Represents Baidu Mercator metric coordinates
Code up
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);// Longitude and latitude after conversion
// }
}
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;
}
边栏推荐
- 2021 Yahong pen test questions
- Deeply understand the fusing configuration of istio traffic management
- I'll show you a little chat! Summary of single merchant function modules
- 2021 Kent interview question 2
- Image semantic segmentation practice: tensorflow deeplobv3+ train your own dataset
- Ffmpeg get the first frame
- Mlx90640 infrared thermal imager temperature sensor module development notes (VIII)
- Stm32f103c8t6 + 0.96 "I2C OLED display 3d_cube
- Automatic conversion and cast
- LwIP development | socket | TCP | client
猜你喜欢

Remote serial port server (adapter) UART to 1-wire application

Stm32cube infrared remote control: input capture

QT packaging

How to measure the vibrating wire sensor by vibrating wire acquisition module?

使用js直传oss阿里云存储文件,解决大文件上传服务器限制

Leetcode topic

I'll show you a little chat! Summary of single merchant function modules

2021 Yahong pen test question 2

8051 series MCU firmware upgrade IAP

IT远程运维是什么意思?远程运维软件哪个好?
随机推荐
PHP计算坐标距离
JS stack
Leetcode topic
Application of optical rain gauge to rainfall detection
Implementation of skip table
Food safety | these two kinds of melons and fruits should be improved, especially for pregnant women with constipation
Sdl2 concise tutorial (4): using SDL_ Image library importing pictures
QT packaging
IT远程运维是什么意思?远程运维软件哪个好?
为什么学编程的人大多数都去了深圳和北京?
2021 Kent interview question 3
JS queue
Rust Getting Started Guide (crite Management)
我在上海偶遇数字凤凰#坐标徐汇美罗城
ffmpeg获取首帧
深入理解Istio流量管理的熔断配置
Thoughts on solving the pop-up of malicious computer advertisements
Deeply understand the fusing configuration of istio traffic management
百度编辑器ueditor,编辑内容过多时,工具栏不可见,不方便编辑或上传问题
QT打包