package com.speedtime;
/**
* @author zhaoweizheng
* @version Copyright by www.speedChina.com
* @Description:
* @date 2018/8/7
* 跟踪单号:
* 修改内容:
*/
/**
* Created by hasee on 2017/7/31.
*/
public class Transform {
double x_PI = 3.14159265358979324 * 3000.0 / 180.0;
double PI = 3.1415926535897932384626;
double a = 6378245.0;
double ee = 0.00669342162296594323;
/**
* 百度坐标系 (BD-09) 与 火星坐标系 (GCJ-02)的转换
* 即 百度 转 谷歌、高德
* @param bd_lon
* @param bd_lat
* @returns {*[]}
*/
public double[] bd09togcj02(double bd_lon, double bd_lat){
double[] result = ;
double x = bd_lon - 0.0065;
double y = bd_lat - 0.006;
double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI);
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI);
double gg_lng = z * Math.cos(theta);
double gg_lat = z * Math.sin(theta);
result[0] = gg_lng;
result[1] = gg_lat;
return point;
}
/**
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换
* 即谷歌、高德 转 百度
* @param lng
* @param lat
* @returns {*[]}
*/
public Point gcj02tobd09(double lng, double lat){
double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI);
double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI);
double bd_lng = z * Math.cos(theta) + 0.0065;
double bd_lat = z * Math.sin(theta) + 0.006;
Point point=new Point(bd_lng, bd_lat);
return point;
};
/**
* WGS84转GCj02
* @param lng
* @param lat
* @returns {*[]}
*/
public Point wgs84togcj02(double lng, double lat){
double dlat = transformlat(lng - 105.0, lat - 35.0);
double dlng = transformlng(lng - 105.0, lat - 35.0);
double radlat = lat / 180.0 * PI;
double magic = Math.sin(radlat);
magic = 1 - ee * magic * magic;
double sqrtmagic = Math.sqrt(magic);
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
double mglat = lat + dlat;
double mglng = lng + dlng;
Point point=new Point(mglng, mglat);
return point;
};
/**
* GCJ02 转换为 WGS84
* @param lng
* @param lat
* @returns {*[]}
*/
public Point gcj02towgs84(double lng, double lat){
double dlat = transformlat(lng - 105.0, lat - 35.0);
double dlng = transformlng(lng - 105.0, lat - 35.0);
double radlat = lat / 180.0 * PI;
double magic = Math.sin(radlat);
magic = 1 - ee * magic * magic;
double sqrtmagic = Math.sqrt(magic);
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
double mglat = lat + dlat;
double mglng = lng + dlng;
Point point=new Point(mglng, mglat);
return point;
};
private double transformlat(double lng,double lat){
double ret= -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0;
ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0;
return ret;
}
private double transformlng(double lng,double lat){
double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0;
ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0;
return ret;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
leaflet 地图插件整合 idea环境 (111个子文件)
.babelrc 132B
mvnw.cmd 5KB
font-awesome.min.css 20KB
leaflet.css 14KB
L.Control.Zoominfo.css 3KB
Control.MiniMap.css 2KB
fonts.googleapis.css 1KB
leaflet.fullscreen.css 1014B
L.Control.MousePosition.css 239B
.gitignore 268B
indexTianDiTu.html 2KB
speedtime.iml 7KB
maven-wrapper.jar 46KB
Transform.java 4KB
DemoApplicationTests.java 337B
DemoApplication.java 313B
leaflet-src.js 396KB
leaflet.js 137KB
proj4-compressed.js 72KB
bundle.js 27KB
index.js 20KB
Control.MiniMap.js 12KB
proj4leaflet.js 7KB
map.js 7KB
Leaflet.fullscreen.js 6KB
L.Control.Zoominfo.js 4KB
Leaflet.fullscreen.min.js 4KB
leaflet.ChineseTmsProviders.js 3KB
leaflet.functionaltilelayer.js 2KB
L.Control.MousePosition.js 1KB
baidu.js 1KB
main.js 29B
bundle.js.map 57KB
mvnw 6KB
.name 9B
marker-icon-2x.png 2KB
marker-icon.png 1KB
layers-2x.png 1KB
layers.png 696B
marker-shadow.png 618B
fullscreen@2x.png 420B
fullscreen.png 299B
toggle.png 219B
maven-wrapper.properties 110B
application.properties 0B
toggle.svg 8KB
S6u9w4BMUTPHh7USSwiPGQ.woff2 23KB
S6u9w4BMUTPHh50XSwiPGQ.woff2 22KB
S6u9w4BMUTPHh7USSwaPGR_p.woff2 5KB
S6u9w4BMUTPHh50XSwaPGR_p.woff2 5KB
workspace.xml 36KB
pom.xml 2KB
Project_Default.xml 1KB
Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_0_4_RELEASE.xml 769B
Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_0_4_RELEASE.xml 762B
Maven__org_springframework_boot_spring_boot_starter_logging_2_0_4_RELEASE.xml 748B
Maven__org_springframework_boot_spring_boot_autoconfigure_2_0_4_RELEASE.xml 734B
Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_1_3_2.xml 730B
Maven__org_springframework_boot_spring_boot_starter_jdbc_2_0_4_RELEASE.xml 727B
Maven__org_springframework_boot_spring_boot_starter_test_2_0_4_RELEASE.xml 727B
Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_1_RELEASE.xml 725B
Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml 700B
Maven__org_springframework_boot_spring_boot_starter_2_0_4_RELEASE.xml 692B
Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_1_3_2.xml 688B
Maven__org_springframework_boot_spring_boot_test_2_0_4_RELEASE.xml 671B
Maven__org_springframework_spring_expression_5_0_8_RELEASE.xml 658B
Maven__org_springframework_spring_context_5_0_8_RELEASE.xml 637B
Maven__org_springframework_boot_spring_boot_2_0_4_RELEASE.xml 636B
Maven__org_thymeleaf_thymeleaf_spring5_3_0_9_RELEASE.xml 634B
compiler.xml 630B
Maven__org_springframework_spring_beans_5_0_8_RELEASE.xml 623B
Maven__org_springframework_spring_core_5_0_8_RELEASE.xml 616B
Maven__org_springframework_spring_jdbc_5_0_8_RELEASE.xml 616B
Maven__org_springframework_spring_test_5_0_8_RELEASE.xml 616B
Maven__javax_annotation_javax_annotation_api_1_3_2.xml 611B
Maven__org_springframework_spring_jcl_5_0_8_RELEASE.xml 609B
Maven__org_springframework_spring_aop_5_0_8_RELEASE.xml 609B
Maven__org_apache_logging_log4j_log4j_to_slf4j_2_10_0.xml 608B
Maven__org_springframework_spring_tx_5_0_8_RELEASE.xml 602B
Maven__org_attoparser_attoparser_2_0_4_RELEASE.xml 589B
Maven__org_unbescape_unbescape_1_1_5_RELEASE.xml 578B
Maven__net_bytebuddy_byte_buddy_agent_1_7_11.xml 578B
Maven__org_thymeleaf_thymeleaf_3_0_9_RELEASE.xml 578B
Maven__mysql_mysql_connector_java_5_1_46.xml 574B
Maven__org_apache_logging_log4j_log4j_api_2_10_0.xml 573B
Maven__ch_qos_logback_logback_classic_1_2_3.xml 568B
Maven__org_hamcrest_hamcrest_library_1_3.xml 553B
Maven__org_mybatis_mybatis_spring_1_3_2.xml 549B
Maven__ch_qos_logback_logback_core_1_2_3.xml 547B
Maven__com_jayway_jsonpath_json_path_2_4_0.xml 546B
Maven__net_minidev_accessors_smart_1_2.xml 542B
Maven__org_mockito_mockito_core_2_15_0.xml 542B
Maven__org_postgresql_postgresql_42_2_4.xml 540B
Maven__org_skyscreamer_jsonassert_1_5_0.xml 537B
Maven__net_bytebuddy_byte_buddy_1_7_11.xml 536B
Maven__org_assertj_assertj_core_3_9_1.xml 535B
Maven__org_xmlunit_xmlunit_core_2_5_1.xml 535B
Maven__org_slf4j_jul_to_slf4j_1_7_25.xml 534B
Maven__org_hamcrest_hamcrest_core_1_3.xml 532B
Maven__org_slf4j_slf4j_api_1_7_25.xml 513B
共 111 条
- 1
- 2
资源评论
supergiser2019
- 粉丝: 3
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功