百度地圖 —— 百度坐標系:bd09
高德地圖 —— 火星坐標系:GCJ-02坐標系
兩者之間的差異就不多說了阴孟,網(wǎng)上資料大把的有,最近在開發(fā)中遇到了百度地圖調(diào)起高德地圖后發(fā)現(xiàn)定位偏差税迷,原因就是兩者經(jīng)緯度定位方式不同永丝,轉(zhuǎn)換其實也很簡單,貼代碼:
// 百度地圖經(jīng)緯度轉(zhuǎn)換為高德地圖經(jīng)緯度
- (CLLocationCoordinate2D)getGaoDeCoordinateByBaiDuCoordinate:(CLLocationCoordinate2D)coordinate
{
return CLLocationCoordinate2DMake(coordinate.latitude - 0.006, coordinate.longitude - 0.0065);
}
// 高德地圖經(jīng)緯度轉(zhuǎn)換為百度地圖經(jīng)緯度
- (CLLocationCoordinate2D)getBaiDuCoordinateByGaoDeCoordinate:(CLLocationCoordinate2D)coordinate
{
return CLLocationCoordinate2DMake(coordinate.latitude + 0.006, coordinate.longitude + 0.0065);
}
如有問題請留言箭养!