当前位置:网站首页>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;
}
边栏推荐
- 李宏毅《机器学习》丨4. Deep Learning(深度学习)
- 不懂就问,快速成为容器服务进阶玩家!
- 我在上海偶遇数字凤凰#坐标徐汇美罗城
- Roson的Qt之旅#101 Qt Quick中的模型和视图
- NTC, PT100 thermal resistance to 4-20mA temperature signal converter
- High precision absolute angle sensor application high speed angle monitoring
- Use py to automatically generate weekly reports based on log records
- Detectron2 installation and testing
- 使用py,根据日志记录自动生成周报
- flashfxp 530 User cannot log in. ftp
猜你喜欢

Headline article_ signature

Temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)

LwIP development | realize TCP server through socket

2-channel Di high-speed pulse counter, 1-channel encoder to Modbus TCP wired wireless module ibf161

JS linked list 01

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

MySQL view event status statements and modification methods

CoDeSys realizes bubble sorting

Zhengda cup hacker marathon data analysis competition

flashfxp 530 User cannot log in. ftp
随机推荐
R language ggplot2 visually draws line plots, and uses gghighlight package to highlight the lines that meet the combination judgment conditions in the line graphs (satisfies both condition a and b)
QT QString详解
Brief tutorial for soft exam system architecture designer | software debugging
The video Number finds the golden key, and Tiktok imitates the latecomers
ANSA二次开发 - 抽中面的两种方法
Stm32cube infrared remote control: input capture
Qt学习第一天
仅需三步 轻松实现远程办公
深入理解Istio流量管理的熔断配置
Thoughts on solving the pop-up of malicious computer advertisements
PHP图片合成技术
C language exception handling mechanism: jump function jump function setjmp/sigsetjmp and longjmp/siglongjmp
关于标准IO缓冲区的问题
Qt学习之Qt Designer(设计师)
Remote serial port server (adapter) UART to 1-wire application
Leetcode topic
SCI scientific paper writing Growth Camp (full version)
R语言使用fs包的file_delete函数删除指定文件夹下的指定文件、举一反三、dir_delete函数、link_delete函数可以用来删除文件夹和超链接
Qt学习之安装
I'll show you a little chat! Summary of single merchant function modules