当前位置:网站首页>坐标转换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
边栏推荐
- Openharmony open source developer growth plan, looking for new open source forces that change the world!
- JVM的类加载过程
- Simplified path (force buckle 71)
- WebView saves the last browsing location
- Seata处理分布式事务
- The corresponding permissions required to automatically open the app in the setting interface through accessibility service
- Client interns of a large factory share their experience face to face
- Go language GUI framework Fyne Chinese garbled or not displayed
- Xlslib use
- RPM包管理
猜你喜欢
Eight bit binary multiplier VHDL
The difference between ordinary inner class and static inner class
c#:泛型反射
Client interns of a large factory share their experience face to face
Android Development: the client obtains the latest value in the database in real time and displays it on the interface
Using Visual Studio code to develop Arduino
I just want to leave a note for myself
ESP32 LVGL8. 1 - arc (arc 19)
2022.04.23 (the best time for lc_714_to buy and sell stocks, including handling charges)
Wechat applet part of the mobile phone Preview PDF did not respond
随机推荐
【历史上的今天】4 月 23 日:YouTube 上传第一个视频;网易云音乐正式上线;数字音频播放器的发明者出生
MVVM model
12个例子夯实promise基础
Scrollto and scrollby
Practice of Druid SQL and security in meituan review
Recyclerview control list item layout match_ Fundamental principle of parent attribute invalidation
mysql_linux版本的下載及安裝詳解
SSDB foundation 1
SSDB基础1
Using 8266 as serial port debugging tool
ESP32 LVGL8. 1 - checkbox (checkbox 23)
Introduction to ROS learning notes (I)
Getting started with vcpkg
ESP32 LVGL8. 1. Detailed migration tutorial of m5stack + lvgl + IDF (27)
12 examples to consolidate promise Foundation
Nacos作为服务配置中心实战
Redis common interview questions
Using bafayun to control the computer
static类变量快速入门
openlayers 5.0 加载arcgis server 切片服务