1
回答
ios 高德地图 批量逆编码
【腾讯云】校园拼团福利,1核2G服务器10元/月!>>>   
@interface ViewController ()<AMapSearchDelegate>
{
    AMapSearchAPI *_search;
}
 
-(void)viewDidLoad 
{
    //初始化检索对象 
    _search = [[AMapSearchAPI alloc] initWithSearchKey:@"您的key"Delegate:self];
     
    //构造AMapReGeocodeSearchRequest对象,location为必选项,radius为可选项
    AMapReGeocodeSearchRequest *regeoRequest = [[AMapReGeocodeSearchRequest alloc] init];
    regeoRequest.searchType = AMapSearchType_ReGeocode;
    regeoRequest.location = [AMapGeoPoint locationWithLatitude:39.990459     longtitude:116.481476];
    regeoRequest.radius = 10000;
    regeoRequest.requireExtension = YES;
 
    //发起逆地理编码
    [_search AMapReGoecodeSearch: regeoRequest];
 
}
 
//实现逆地理编码的回调函数
- (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response
{
    if(response.regeocode != nil)
    {
        //通过AMapReGeocodeSearchResponse对象处理搜索结果
        NSString *result = [NSString stringWithFormat:@"ReGeocode: %@", response.regeocode];
        NSLog(@"ReGeo: %@", result);
    }

}

怎样才能实现批量逆编码,好像每次回调只执行一次

<无标签>
举报
KANON-
发帖于3年前 1回/2K+阅
共有1个答案 最后回答: 3年前

lz自己查了一下,高德目前不支持批量操作,我用苹果自带的地图控件进行了代替,这个支持批量操作。

  CLLocation *c = [[CLLocation alloc] initWithLatitude:39.990459 longitude:116.481476];
    //创建位置
    CLGeocoder *revGeo = [[CLGeocoder alloc] init];
    [revGeo reverseGeocodeLocation:c
     //反向地理编码
                 completionHandler:^(NSArray *placemarks, NSError *error) {
                     if (!error && [placemarks count] > 0)
                     {
                         NSDictionary *dict =
                         [[placemarks objectAtIndex:0] addressDictionary]; NSLog(@"street address: %@",[dict objectForKey :@"Street"]);
                     }
                     else
                     {
                         NSLog(@"ERROR: %@", error); }
                 }];

顶部