根据经纬度取地址 高德、百度
来源:互联网 发布:55开淘宝店地址服装 编辑:程序博客网 时间:2024/05/17 01:02
系统自带的方法:
//根据经纬度解析成位置
- CLGeocoder *geocoder=[[[CLGeocoder alloc]init]autorelease];
- [geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemark,NSError *error)
- {
- CLPlacemark *mark=[placemark objectAtIndex:0];
- place.title=@"没有当前位置的详细信息";
- place.subTitle=@"详细信息请点击‘附近’查看";
- place.title=[NSString stringWithFormat:@"%@%@%@",mark.subLocality,mark.thoroughfare,mark.subThoroughfare];
- place.subTitle=[NSString stringWithFormat:@"%@",mark.name];//获取subtitle的信息
- [self.myMapView selectAnnotation:place animated:YES];
- } ];
// 百度地图反编译
-(void)mapViewWillStartLocatingUser:(BMKMapView *)mapView{ NSLog(@"开始定位");}/** *用户位置更新后,会调用此函数 *@param mapView 地图View *@param userLocation 新的用户位置 */-(void)mapView:(BMKMapView *)mapView didUpdateUserLocation:(BMKUserLocation *)userLocation{ NSLog(@"latitude--%f,longtitude---%f",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude); locaLatitude=userLocation.location.coordinate.latitude;//纬度 locaLongitude=userLocation.location.coordinate.longitude;//精度 BMKCoordinateRegion region; //将定位的点居中显示 region.center.latitude=locaLatitude; region.center.longitude=locaLongitude; //反地理编码出地理位置 CLLocationCoordinate2D pt=(CLLocationCoordinate2D){0,0}; pt=(CLLocationCoordinate2D){locaLatitude,locaLongitude}; BOOL flag=[_search reverseGeocode:pt]; if (flag) { myMapView.showsUserLocation=NO;//不显示自己的位置 self.btnDone.enabled=YES; } //当前位置标注和地图的比例(注释为可不用)//BMKCoordinateSpan spans;//spans.latitudeDelta=0.01;//spans.longitudeDelta=0.01;//region.span=spans; myMapView.region=region;}
在使用 [_search reverseGeocode:pt] 的时候,会调用它的一个协议方法,也就是下面的方法:
//反地理编码-(void)onGetAddrResult:(BMKAddrInfo *)result errorCode:(int)error{ if (error==0) { BMKPointAnnotation *item=[[BMKPointAnnotation alloc] init]; item.coordinate=result.geoPt;//地理坐标 item.title=result.strAddr;//地理名称 [myMapView addAnnotation:item]; myMapView.centerCoordinate=result.geoPt; self.lalAddress.text=[result.strAddr stringByReplacingOccurrencesOfString:@"-" withString:@""]; if (![self.lalAddress.text isEqualToString:@""]) { strProvince=result.addressComponent.province;//省份 strCity=result.addressComponent.city;//城市 strDistrict=result.addressComponent.district;//地区 }//CLGeocoder *geocoder=[[CLGeocoder alloc] init];//CLGeocodeCompletionHandler handle=^(NSArray *palce,NSError *error){//for (CLPlacemark *placemark in palce) {//NSLog(@"%@1-%@2-%@3-%@4-%@5-%@6-%@7-%@8-%@9-%@10-%@11-%@12",placemark.name,placemark.thoroughfare,placemark.subThoroughfare,placemark.locality,placemark.subLocality,placemark.administrativeArea,placemark.postalCode,placemark.ISOcountryCode,placemark.country,placemark.inlandWater,placemark.ocean,placemark.areasOfInterest);//break;//}//};//CLLocation *loc = [[CLLocation alloc] initWithLatitude:locaLatitude longitude:locaLongitude];//[geocoder reverseGeocodeLocation:loc completionHandler:handle]; }}
0 0
- 根据经纬度取地址 高德、百度
- 百度地图 根据地址获取经纬度
- 百度地图根据经纬度获取地址
- 百度api根据经纬度获取地址
- .net根据经纬度获取地址(百度api)
- 百度地图根据地址获取经纬度
- java根据地址获取百度API经纬度
- 百度地图 java 根据地址获取经纬度
- java 根据经纬度获取百度地图地址
- 百度API-根据地址获取经纬度
- android 百度地图根据地址检索经纬度
- java 百度高德实现地址转经纬度
- 百度地图应用:根据两个地址的经纬度求距离;根据地址求经纬度;根据经纬度求地址
- 百度接口示例:根据地址获取该地址的经纬度
- 调用百度地图API确定地址的经纬度,根据地址的经纬度查找中文地址
- 基于Xposed 拦截百度 高德地图 实现根据经纬度 改变当前位置
- 百度地图API之根据经纬度查询地址信息(Android)
- 百度地图API之根据经纬度查询地址信息(Android)
- MyEclipse Web 项目泛红 报错 排查 原因
- Android Drawable 那些不为人知的高效用法
- Request对象详细介绍
- NYOJ 1022
- ORA-01033: ORACLE initialization or shutdown in progress
- 根据经纬度取地址 高德、百度
- Linux学习之第十九、条件判断
- python3.4交叉编译与移植
- Golang日志--Seelog的简单用法
- 程序实现自启动的方式总结
- IOS多张图片合成一个视频
- IOS视频添加背景音乐同时保留原音
- Windows系统程序设计之结构化异常处理
- [清橙A1363][THUSC 2012]水位(并查集+高精度压位)