zl程序教程

您现在的位置是:首页 >  其他

当前栏目

地图与定位之地理编码

编码定位 地图 地理
2023-09-14 08:57:58 时间
NSString *address=@"天安门"; CLLocation *clLocation=[[CLLocation alloc]initWithLatitude:39.54 longitude:116.28]; _cLGeocoder=[[CLGeocoder alloc]init];
//编码 [_cLGeocoder geocodeAddressString:address completionHandler:^(NSArray *placemarks, NSError *error) { CLPlacemark *placemark=[placemarks firstObject]; CLLocation *cllocation=placemark.location; CLRegion *clRegion=placemark.region; NSDictionary *addressdic=placemark.addressDictionary; NSLog(@"编码: %@ %@ %@",cllocation,clRegion,addressdic);
//反编码 [_cLGeocoder reverseGeocodeLocation:clLocation completionHandler:^(NSArray *placemarks, NSError *error) { CLPlacemark *placemark=[placemarks firstObject]; NSLog(@"反编码: %@",placemark); - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.
百度地图API地理位置和坐标转换 .由地名(省份、城市、街道等)得到其对应的百度地图坐标: http://api.map.baidu.com/geocoder/v2/?output=json&ak=你从百度申请到的Key&address=北京市 其对大陆主要城市的解析很好,但是有些大陆的小城市、香港、台湾的一些区域无法解析,我测试到.
社会主义 从.Net到iOS,在撸的道路上越走越远,工作之余经营着博客园http://www.cnblogs.com/5ishare,欢迎小伙伴(妹子更好)一起交流,谈谈人生理想。作为经常从网上索取免费资料的一员,要有回报回报的思想,也让更多的人少走弯路.