GPS使用的是WGS-84
高德地图的是GCJ-02
public class Converter {
private final static double a = 6378245.0;
private final static double pi = 3.14159265358979324;
private final static double ee = 0.00669342162296594323;
// WGS-84 to GCJ-02
public static LatLonPoint toGCJ02Point(double latitude, double longitude) {
LatLonPoint dev = calDev(latitude, longitude);
double retLat = latitude + dev.getLatitude();
double retLon = longitude + dev.getLongitude();
return new LatLonPoint(retLat, retLon);
}
// GCJ-02 to WGS-84
public static LatLonPoint toWGS84Point(double latitude, double longitude) {
LatLonPoint dev = calDev(latitude, longitude);
double retLat = latitude - dev.getLatitude();
double retLon = longitude - dev.getLongitude();
dev = calDev(retLat, retLon);
retLat = latitude - dev.getLatitude();
retLon = longitude - dev.getLongitude();
r

该博客介绍了一个用于转换GPS使用的WGS-84坐标到高德地图的GCJ-02坐标的算法,同时也提供了从GCJ-02回转到WGS-84的算法。通过定义的一系列计算方法,包括`toGCJ02Point`和`toWGS84Point`,实现了坐标之间的互换。此外,还包含判断是否在中国范围内的辅助函数`isOutOfChina`。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



