逆地理编码
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);
}];
}
//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);
}];
}
相关文章推荐
- Apache MiNa 实现多人聊天室
- php mongodb扩展安装
- linux下查看网络连接
- Spring注解
- Tuxedo总体介绍
- oracle的背景
- 基于Jenkins的自动构建系统开发
- HackerRank "Dorsey Thief"
- Outlook2013怎样自动答复电子邮件
- windbg的lm命令
- 建轨迹条——createTrackbar函数
- 九宫格的缩放策略
- Java基础:访问修饰符
- 快速Android开发系列网络篇之Retrofit
- 工薪族需反思 为何你工作3年月薪还没过万?
- 【C#之值类型vs引用类型】
- 空间滤波&频域滤波(3)
- SQL 语言划分
- Office Web Apps2013安装部署
- Oracle 死锁的检测查询及处理