7.8 Converting Longitude and Latitude to a Meaningful Address
来源:互联网 发布:西安软件行业 编辑:程序博客网 时间:2024/04/30 08:32
通过经纬度获取地址信息
- (void)viewDidLoad
{
[superviewDidLoad];
CLLocation *location = [[CLLocationalloc]initWithLatitude:39.904989
longitude:116.405285];
self.myGeocoder = [[CLGeocoderalloc]init];
[self.myGeocoder
reverseGeocodeLocation:locationcompletionHandler:^(NSArray *placemarks,NSError *error) {
if (error ==nil && [placemarkscount] >0){
CLPlacemark *placemark = [placemarksobjectAtIndex:0];/* We received the results */
NSLog(@"Country = %@", placemark.country);
NSLog(@"name = %@", placemark.name);
NSLog(@"thoroughfare = %@", placemark.thoroughfare);
NSLog(@"subThoroughfare = %@", placemark.subThoroughfare);
NSLog(@"locality = %@", placemark.locality);
NSLog(@"subLocality = %@", placemark.subLocality);
NSLog(@"administrativeArea = %@", placemark.administrativeArea);
NSLog(@"subAdministrativeArea = %@", placemark.subAdministrativeArea);
NSLog(@"postalCode = %@", placemark.postalCode);
NSLog(@"ISOcountryCode = %@", placemark.ISOcountryCode);
NSLog(@"inlandWater = %@", placemark.inlandWater);
NSLog(@"ocean = %@", placemark.ocean);
NSLog(@"areasOfInterest = %@", placemark.areasOfInterest);
}
elseif (error ==nil &&
[placemarkscount] ==0){
NSLog(@"No results were returned.");
}
elseif (error !=nil){
NSLog(@"An error occurred = %@", error); }
}];
}
输出:
2014-04-08 14:12:59.756 cookbook[592:c07] Country = China
2014-04-08 14:12:59.758 cookbook[592:c07] name = Danta Coffee
2014-04-08 14:12:59.758 cookbook[592:c07] thoroughfare = Danta Coffee
2014-04-08 14:12:59.758 cookbook[592:c07] subThoroughfare = (null)
2014-04-08 14:12:59.759 cookbook[592:c07] locality = (null)
2014-04-08 14:12:59.759 cookbook[592:c07] subLocality = Dongcheng
2014-04-08 14:12:59.760 cookbook[592:c07] administrativeArea = Beijing
2014-04-08 14:12:59.760 cookbook[592:c07] subAdministrativeArea = (null)
2014-04-08 14:12:59.760 cookbook[592:c07] postalCode = (null)
2014-04-08 14:12:59.760 cookbook[592:c07] ISOcountryCode = CN
2014-04-08 14:12:59.761 cookbook[592:c07] inlandWater = (null)
2014-04-08 14:12:59.761 cookbook[592:c07] ocean = (null)
2014-04-08 14:12:59.761 cookbook[592:c07] areasOfInterest = (null)
如果输入的经纬度是:
CLLocation *location = [[CLLocationalloc] initWithLatitude:24.5
longitude:118.13];
则输出是:
2014-04-08 14:16:19.442 cookbook[613:c07] Country = China
2014-04-08 14:16:19.443 cookbook[613:c07] name = No. 1389 Xianyue Road
2014-04-08 14:16:19.443 cookbook[613:c07] thoroughfare = Xianyue Road
2014-04-08 14:16:19.444 cookbook[613:c07] subThoroughfare = No. 1389
2014-04-08 14:16:19.444 cookbook[613:c07] locality = Xiamen
2014-04-08 14:16:19.444 cookbook[613:c07] subLocality = Huli
2014-04-08 14:16:19.444 cookbook[613:c07] administrativeArea = Fujian
2014-04-08 14:16:19.445 cookbook[613:c07] subAdministrativeArea = (null)
2014-04-08 14:16:19.445 cookbook[613:c07] postalCode = (null)
2014-04-08 14:16:19.445 cookbook[613:c07] ISOcountryCode = CN
2014-04-08 14:16:19.445 cookbook[613:c07] inlandWater = (null)
2014-04-08 14:16:19.446 cookbook[613:c07] ocean = (null)
2014-04-08 14:16:19.446 cookbook[613:c07] areasOfInterest = (null)
- 7.8 Converting Longitude and Latitude to a Meaningful Address
- 7.7 Converting Meaningful Addresses to Longitude and Latitude
- Latitude And Longitude
- Calculate distance based on GPS data (latitude and longitude)
- Calculate distance, bearing and more between Latitude/Longitude points
- Finding Points Within a Distance of a Latitude/Longitude Using Bounding Coordinates
- Latitude, Longitude, PHP and the Yahoo Geocoder PHP 通过 Yahoo Geocoder 获得地理经纬度
- GPS经纬度和距离计算Calculate distance, bearing and more between Latitude/Longitude points
- Google Map,Baidu Map,latitude,longitude
- Calculate distance, bearing and more between Latitude/Longitude points——根据两点经纬度计算距离,角度及其他
- Converting a bitmap to a region
- Converting a List to a DataTable
- Converting a JSF 1.2 application to JSF 2.0 - Facelets and Ajax
- decruft(A library to extract meaningful data from a webpage) 源码分析
- Converting numbers to strings and strings to numbers
- Converting numbers to strings and strings to numbers
- Converting a BMP Image to a PNG Image
- Converting a project from a waterfall to an iterative approach
- Java mysql连接
- 【4月限时免费】车载环境中文手机录音数据
- thinkphp中使用frameset
- 常用awk命令(转)
- 第七周项目一深复制体验(1)
- 7.8 Converting Longitude and Latitude to a Meaningful Address
- 10大清宿便排毒方法及简单排毒瘦小腹运动
- Android开发の五大布局
- PHP连接SAE平台MYSQL
- 多线程之原子操作
- Statement和PreparedStatement区别
- 黑马程序员——IOS基础——Block
- 2014-第七周项目一---体验深复制
- 通过Excel直接操作数据库DB的工具