当前位置:网站首页>Coordinate conversion WGS-84 to gcj-02 and gcj-02 to WGS-84
Coordinate conversion WGS-84 to gcj-02 and gcj-02 to WGS-84
2022-04-23 19:09:00 【GIS roast lamb leg is delicious】
/*//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: The projection factor of the satellite ellipsoid coordinate projected to the plane map coordinate system .
var ee = 0.00669342162296594323; // ee: Eccentricity of ellipsoid .
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 turn wgs84
static gcj_wgs(lng, lat){
if (this.out_of_china(lng, lat)) {
return [lng, lat];
}
else {
var a = 6378245.0; // a: The projection factor of the satellite ellipsoid coordinate projected to the plane map coordinate system .
var ee = 0.00669342162296594323; // ee: Eccentricity of ellipsoid .
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 roast lamb leg is delicious]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231908120743.html
边栏推荐
- Scrollto and scrollby
- 12 examples to consolidate promise Foundation
- js获取本机ip地址
- [today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born
- Methods of nested recycleview to solve sliding conflict and incomplete item display
- SSDB foundation 3
- Download xshell 6 and xftp6 official websites
- SQL server requires to query the information of all employees with surname 'Wang'
- Xlslib use
- Using Visual Studio code to develop Arduino
猜你喜欢
Practice of Druid SQL and security in meituan review
ESP32 LVGL8. 1 - msgbox message box (msgbox 28)
MySQL学习第五弹——事务及其操作特性详解
One of the reasons why the WebView web page cannot be opened (and some WebView problem records encountered by myself)
I just want to leave a note for myself
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
mysql通过binlog恢复或回滚数据
After opening the original normal project, the dependency package displays red and does not exist.
ArcMap连接 arcgis server
开关电源设计分享及电源设计技巧图解
随机推荐
2022.04.23 (lc_763_divided into letter interval)
Is it safe to open an account in Bohai futures.
2022.04.23(LC_714_买卖股票的最佳时机含手续费)
ESP32 LVGL8. 1 - roller rolling (roller 24)
[play with lighthouse] Tencent cloud lightweight server builds a full platform video analysis video download website
Solutions such as unknown or garbled code or certificate problem prompt in Charles's mobile phone packet capture, actual measurement.
Modify the font size of hint in editext
从技术体系到商业洞察,中小研发团队架构实践之收尾篇
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
Xlslib use
MVVM model
Yyds dry goods inventory stringprep --- Internet string preparation
Scrollto and scrollby
Network protocol: SCTP flow control transmission protocol
Codeforces Round #784 (Div. 4)
简化路径(力扣71)
Oracle配置st_geometry
Eight bit binary multiplier VHDL
redis优化系列(三)解决主从配置后的常见问题
SSDB基础1