【发布时间】:2014-03-22 20:36:52
【问题描述】:
我不确定这是否是谷歌地图的新功能,但我认为这个版本的 iOS 版谷歌地图似乎已经有了反向地理编码方法……我真的不知道如何使用。 In their documentation page,在相机位置部分下,它们有一个功能,但它看起来不像 SDK 附带的功能......或者可能有一些我不明白的地方。有人可以帮忙吗?这是 XCode 中出现的函数:
- (void)reverseGeocodeCoordinate:(CLLocationCoordinate2D)coordinate
completionHandler:(GMSReverseGeocodeCallback)handler{}
如果我的坐标在数组中,我该如何使用它?如何获取地址和国家以及所有可能的结果?
顺便说一句,这就是他们所拥有的......它如何比较:
- (void)mapView:(GMSMapView *)mapView
idleAtCameraPosition:(GMSCameraPosition *)cameraPosition {
id handler = ^(GMSReverseGeocodeResponse *response, NSError *error) {
if (error == nil) {
GMSReverseGeocodeResult *result = response.firstResult;
GMSMarker *marker = [GMSMarker markerWithPosition:cameraPosition.target];
marker.title = result.addressLine1;
marker.snippet = result.addressLine2;
marker.map = mapView;
}
};
[geocoder_ reverseGeocodeCoordinate:cameraPosition.target completionHandler:handler];
}
【问题讨论】:
标签: ios objective-c google-maps geocoding reverse-geocoding