• Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

iOS Converter location WGS-84 GCJ-02 baidu

TQLocationConverter

English

Location converter

用来相互转换不同标准坐标系

(GCJ-02火星坐标)

(WGS-84 正常GPS坐标)

(百度坐标)

How to use

    //我是个经纬度
    CLLocationCoordinate2D location = (CLLocationCoordinate2D){
        .latitude  = 0.0,
        .longitude = 0.0
    };
    
    //判断是否在中国
    if (![TQLocationConverter isLocationOutOfChina:location])
    {
        //将WGS-84转为GCJ-02(火星坐标)
        location = [TQLocationConverter transformFromWGSToGCJ:location];
        
        //将GCJ-02(火星坐标)转为百度坐标
        location = [TQLocationConverter transformFromGCJToBaidu:location];
        
        //将百度坐标转为GCJ-02(火星坐标)
        location = [TQLocationConverter transformFromBaiduToGCJ:location];
        
        //将GCJ-02(火星坐标)转为WGS-84
        location = [TQLocationConverter transformFromGCJToWGS:location];
    }
    
    NSLog(@"%f,%f",location.latitude,location.longitude);