您的位置:首页 > 其它

逆地理编码

2016-02-03 14:32 246 查看
-(void)geolocation{

    //22.540681,=114.061324

    CLLocationCoordinate2D coordinate;

    coordinate.latitude = 35.691461

    coordinate.longitude =
108.3994845;

    CLLocation *newLocation=[[CLLocation
alloc]initWithLatitude:coordinate.latitude
longitude: coordinate.longitude];

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

    [geocoder reverseGeocodeLocation:newLocation

                   completionHandler:^(NSArray *placemarks,

                                       NSError *error)

     {

         CLPlacemark *placemark=[placemarks
objectAtIndex:0];

         NSLog(@"地理位置:%@\n country:%@\n
postalCode:%@\n ISOcountryCode:%@\n ocean:%@\n inlandWater:%@\n locality:%@\n subLocality:%@ \n administrativeArea:%@\n subAdministrativeArea:%@\n thoroughfare:%@\n subThoroughfare:%@\n",

               placemark.name,

               placemark.country,

               placemark.postalCode,

               placemark.ISOcountryCode,

               placemark.ocean,

               placemark.inlandWater,

               placemark.administrativeArea,

               placemark.subAdministrativeArea,

               placemark.locality,

               placemark.subLocality,

               placemark.thoroughfare,

               placemark.subThoroughfare);

     }];

    

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: