当前位置:网站首页>坐标转换WGS-84 转 GCJ-02 和 GCJ-02转WGS-84
坐标转换WGS-84 转 GCJ-02 和 GCJ-02转WGS-84
2022-04-23 19:08:00 【Gis烤羊腿真好吃】
/*//WGS-84 to GCJ-02*/
static wgs_gcj(lng, lat){
if (this.out_of_china(lng, lat)) {
return [lng, lat];
}else{
var a = 6378245.0; // a: 卫星椭球坐标投影到平面地图坐标系的投影因子。
var ee = 0.00669342162296594323; // ee: 椭球的偏心率。
var dlat = this.transformlat(lng - 105.0, lat - 35.0);
var dlng = this.transformlng(lng - 105.0, lat - 35.0);
var radlat = lat / 180.0 * PI;
var magic = Math.sin(radlat);
magic = 1 - ee * magic * magic;
var sqrtmagic = Math.sqrt(magic);
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
var mglat = lat + dlat;
var mglng = lng + dlng;
return {j:mglng, w:mglat};
}
}
//gcj-02转wgs84
static gcj_wgs(lng, lat){
if (this.out_of_china(lng, lat)) {
return [lng, lat];
}
else {
var a = 6378245.0; // a: 卫星椭球坐标投影到平面地图坐标系的投影因子。
var ee = 0.00669342162296594323; // ee: 椭球的偏心率。
var dlat = this.transformlat(lng - 105.0, lat - 35.0);
var dlng = this.transformlng(lng - 105.0, lat - 35.0);
var radlat = lat / 180.0 * PI;
var magic = Math.sin(radlat);
magic = 1 - ee * magic * magic;
var sqrtmagic = Math.sqrt(magic);
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
var mglat = lat + dlat;
var mglng = lng + dlng;
return {j:lng * 2 - mglng, w:lat * 2 - mglat};
}
}
版权声明
本文为[Gis烤羊腿真好吃]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_38190600/article/details/102488349
边栏推荐
- Nacos as service registry
- 12个例子夯实promise基础
- mysql_ Download and installation of Linux version
- 为何PostgreSQL即将超越SQL Server?
- 从技术体系到商业洞察,中小研发团队架构实践之收尾篇
- The difference between ordinary inner class and static inner class
- Methods of nested recycleview to solve sliding conflict and incomplete item display
- ESP32 LVGL8. 1 - arc (arc 19)
- Zlib realizes streaming decompression
- std::stoi stol stoul stoll stof stod
猜你喜欢

ESP32 LVGL8. 1. Detailed migration tutorial of m5stack + lvgl + IDF (27)

The difference between ordinary inner class and static inner class

Esp32 (UART 485 communication) - 485 communication of serial port (3)

MySQL restores or rolls back data through binlog

Android Development: the client obtains the latest value in the database in real time and displays it on the interface

Druid SQL和Security在美团点评的实践

Getting started with vcpkg

I just want to leave a note for myself
![[today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born](/img/0a/ed4eab6589e1c072edc247463e889e.png)
[today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born

Introduction to ROS learning notes (I)
随机推荐
redis优化系列(三)解决主从配置后的常见问题
SSDB基础3
ESP32 LVGL8. 1 - msgbox message box (msgbox 28)
SSDB foundation 2
ESP32 LVGL8. 1 - arc (arc 19)
【历史上的今天】4 月 23 日:YouTube 上传第一个视频;网易云音乐正式上线;数字音频播放器的发明者出生
8266 obtain 18b20 temperature
SQL常用的命令
Dynamically add and delete layouts
[record] typeerror: this getOptions is not a function
The type initializer for ‘Gdip‘ threw an exception
ESP32 LVGL8. 1 - roller rolling (roller 24)
Go 语言 GUI 框架 fyne 中文乱码或者不显示的问题
Wechat applet part of the mobile phone Preview PDF did not respond
Treatment of incomplete display of listview height
在渤海期货办理开户安全吗。
openlayers 5.0 离散聚合点
openlayers 5.0 热力图
Circuit on-line simulation
Esp32 (UART 485 communication) - 485 communication of serial port (3)