2013-07-10 134 views
-1

我找到当前latitudelongitude使用GPS(没有互联网)使用GPS的反向地理编码

现在我想实现reverse geocoding使用该经纬度通过GPS没有互联网。

我已成功实施与互联网连接的反向地理编码。

这是我实现的代码: -

CLGeocoder * geoCoder = [[CLGeocoder alloc] init]; 
[geoCoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error) { 

    NSString * location = ([placemarks count] > 0) ? [[placemarks objectAtIndex:0] locality] : @"Not Found"; 

    CLPlacemark *placemark = [placemarks objectAtIndex:0]; 

    NSString *MyAddress = @""; 
    MyAddress = [[placemark.addressDictionary objectForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "]; 
    NSLog(@"address is %@", MyAddress); 
}]; 

我已经搜索这个,但找不到任何解决办法。

我该怎么做?

谢谢。

+0

http://stackoverflow.com/questions/14588778/offline-reverse-geocoding-on-ios相同作为您的问题 – prasad

+0

该问题的答案是不是一个伟大的只是供参考。 –

回答

0

你不能没有互联网,因为这种方法(reverseGeocodeLocation: completionHandler:)异步提交指定的位置数据到geocoding server并返回。

阅读CLGeocoder Class ReferenceCLGeocoder class

如果你仔细想想,你需要有一个数据库才能得到一个地址,如果不是从远程数据库那里收集这些信息,它应该从何处收集信息。

0

在这里看到:https://stackoverflow.com/a/4419113/2446155

任何方法提到会有工作。请记住,openstreetmap.org只允许您一次下载一小部分数据。 Cloudmate.com可让您一次下载大量数据,但它会让您的应用程序变得非常庞大。

你也可以考虑下载并存储所有的CLGeocoder数据,通过wifi在用户周围的特定区域,然后能够使用它没有互联网,但我不知道这是可能的。