OC

iOS开发中常见定位坐标转换

2018-04-14  本文已影响21人  CocoaJason

Cocoapods支持

pod 'HZLocationConverter'

常见的坐标转换方式

/**
 *  判断是否在中国
 */
+(BOOL)isLocationOutOfChina:(CLLocationCoordinate2D)location;

/**
 *  将WGS-84转为GCJ-02(火星坐标):
 */
+(CLLocationCoordinate2D)transformFromWGSToGCJ:(CLLocationCoordinate2D)wgsLoc;

/**
 *  将GCJ-02(火星坐标)转为WGS-84:
 */
+(CLLocationCoordinate2D)transformFromGCJToWGS:(CLLocationCoordinate2D)p;

/**
 *  将GCJ-02(火星坐标)转为百度坐标:
 */
+(CLLocationCoordinate2D)transformFromGCJToBaidu:(CLLocationCoordinate2D)p;

/**
 *  将百度坐标转为GCJ-02(火星坐标):
 */
+(CLLocationCoordinate2D)transformFromBaiduToGCJ:(CLLocationCoordinate2D)p;

https://github.com/MyHZ/HZLocationConverter

https://github.com/MyHZ/HZLocationConverterExample

https://juejin.im/post/5ad19b9ff265da23741167ae

上一篇下一篇

猜你喜欢

热点阅读