IOS 经纬度 转换地理位置信息

-(NSString*)latitudeStr:(NSString*)LatitudeLongitudeStr:(NSString*)Longitude

{

staticNSString* addstroing =@"";

NSString* A = Latitude;

NSString* B = Longitude;

floata = [AfloatValue];

floatb = [BfloatValue];

CLLocation* location = [[CLLocationalloc]initWithLatitude:alongitude:b];

//位置反编码, IOS5.0之后

CLGeocoder*geocoder = [[CLGeocoderalloc]init];

[geocoderreverseGeocodeLocation:locationcompletionHandler:^(NSArray*placemarks,NSError*error) {

for(CLPlacemark*placemark in placemarks) {

//CLPlacemark 地标

//            NSLog(@"位置:%@", placemark.name);

//            NSLog(@"街道:%@", placemark.thoroughfare);

//            NSLog(@"子街道:%@", placemark.subThoroughfare);

//            NSLog(@"市:%@", placemark.locality);

//            NSLog(@"区\\县:%@", placemark.subLocality);

//            NSLog(@"行政区:%@", placemark.administrativeArea);

//            NSLog(@"国家:%@", placemark.country);

addstroing = [NSStringstringWithFormat:@"%@%@%@%@",placemark.administrativeArea,placemark.locality,placemark.subLocality,placemark.thoroughfare];

addressLabel.text= placemark.name;

}

}];

returnaddstroing;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容