WGS-84:是国际标准,GPS坐标(Google Earth使用、或者GPS模块)
GCJ-02(火星坐标):中国坐标偏移标准,Google Map、高德、腾讯使用
BD-09:百度坐标偏移标准,Baidu Map使用
/*
pi: 圆周率。
a: 卫星椭球坐标投影到平面地图坐标系的投影因子。
ee: 椭球的偏心率。
x_pi: 圆周率转换量。
transformLat(double x, double y): 坐标转换方法。
transformLon(double x, double y): 坐标转换方法。
wgs2gcj(double lat, double lon, double* pLat, double* pLon): WGS坐标转换为GCJ坐标。
gcj2bd(double lat, double lon, double* pLat, double* pLon): GCJ坐标转换为百度坐标。
*/
double pi = 3.14159265358979324;
double a = 6378245.0;
double ee = 0.00669342162296594323;
double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
int wgs2bd(double lat, double lon, double* pLat, double* pLon) {
double lat_ = 0.0, lon_ = 0.0;
wgs2gcj(lat, lon, &lat_, &lon_);
gcj2bd(lat_, lon_, pLat, pLon);
return 0;
}
int gcj2bd(double lat, double lon, double* pLat, double* pLon) {
double x = lon, y = lat;
double z = sqrt(x * x + y * y) + 0.00002 * sin(y * x_pi);
d

本文介绍了地图坐标系统之间的转换,包括WGS-84、GCJ-02(火星坐标)和BD-09(百度坐标)之间的转换。内容涉及国际标准WGS-84坐标,以及中国特有的GCJ-02坐标,以及百度地图使用的BD-09坐标。对于使用GPS模块或在Google Earth中定位的用户,以及在中国地区使用Google Map、高德、腾讯地图的用户,了解这些坐标转换至关重要。
928

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



