【问题标题】:Reverse Geocode using GPS使用 GPS 反向地理编码
【发布时间】:2013-07-10 11:52:06
【问题描述】:

我正在使用GPS (没有互联网)找到当前的latitudelongitude

现在我想在没有互联网的情况下通过 GPS 使用该纬度和经度来实现 reverse geocoding

我已经成功实现了互联网连接的反向地理编码。

这是我实现的代码:-

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);
}];

我已经搜索过这个,但找不到任何解决方案。

我该怎么做?

谢谢。

【问题讨论】:

标签: iphone ios objective-c gps


【解决方案1】:

你不能没有internet,因为这个方法(reverseGeocodeLocation: completionHandler:)将指定的位置数据异步提交给geocoding server并返回。

阅读CLGeocoder Class Reference 以获取CLGeocoder class

如果您考虑一下,您需要有一个数据库才能获取地址,如果不是从远程数据库,它应该从哪里收集该信息。

【讨论】:

    【解决方案2】:

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

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

    您还可以考虑通过 wifi 下载并存储用户周围特定区域的所有 CLGeocoder 数据,然后无需互联网即可使用它,但我不确定这是否可能。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-26
      • 2015-10-31
      • 1970-01-01
      • 2011-01-17
      相关资源
      最近更新 更多