iOS 高德地图 根据经纬度解析成位置

 //根据经纬度解析成位置

CGFloat latitude = [[MLUserModel sharedUserInfo].latitude floatValue];//经度

CGFloat longitude = [[MLUserModel sharedUserInfo].longitude floatValue];//纬度

 CLLocation *location = [[CLLocation alloc]initWithLatitude:latitude longitude:longitude];

  

CLGeocoder *geocoder = [[CLGeocoder alloc]init];

 [geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemark,NSError *error){

                CLPlacemark *mark = [placemark objectAtIndex:0];

               NSLog(@"%@%@%@%@%@",mark.subLocality,mark.thoroughfare,mark.name,mark.locality,mark.subLocality);

 }];

 

    //根据位置解析成经纬度

    CLGeocoder *geocoder = [[CLGeocoder alloc]init];

    [geocoder geocodeAddressString:@"地址" completionHandler:^(NSArray * _Nullable placemarks, NSError * _Nullable error) {

        CLPlacemark *mark = [placemarks objectAtIndex:0];

        weakself.centerCoordinate = mark.location.coordinate;

    }];

转载于:https://www.cnblogs.com/liaolijun/p/7809094.html

你可能感兴趣的:(iOS 高德地图 根据经纬度解析成位置)