Google地图:输入某些国家/地区的坐标时出错

时间:2015-08-24 18:32:35

标签: objective-c google-maps cllocationmanager google-geocoder

我在google map上绘制路线并且意识到一切正常,除了我发送在韩国某处的坐标。(确切地说是南方)

JSON数据为null,即使坐标正确并保持"零结果"'对我说。

我已经尝试过非洲,澳大利亚,欧洲甚至中国和日本,但韩国的任何地方都无法工作。

我在这里错过了什么......?

编辑

所以我猜这不仅仅是韩国蒙古和印度尼西亚是相同的,他们的地理编码不使用航路点来获得路线。

比较韩国和德国的结果 -

韩国

{"geocoded_waypoints" : [
  {
     "geocoder_status" : "OK",
     "place_id" : "ChIJzWXFYYuifDUR64Pq5LTtioU",
     "types" : [ "locality", "political" ]
  },
  {
     "geocoder_status" : "OK",
     "place_id" : "ChIJNc0j6G3raDURpwhxJHTL2DU",
     "types" : [ "locality", "political" ]
  }],"routes" : [],"status" : "ZERO_RESULTS"}

德国

{"geocoded_waypoints" : [
  {
     "geocoder_status" : "OK",
     "place_id" : "ChIJAVkDPzdOqEcRcDteW0YgIQQ",
     "types" : [ "locality", "political" ]},
  {
     "geocoder_status" : "OK",
     "place_id" : "ChIJ2V-Mo_l1nkcRfZixfUq4DAE",
     "types" : [ "locality", "political" ]}],"routes" : [
  {
     "bounds" : {
        "northeast" : {
           "lat" : 52.5200138,
           "lng" : 13.404945
        },
        "southwest" : {
           "lat" : 48.1351972,
           "lng" : 11.1954806
        }
     },
     "copyrights" : "Datos de mapas ©2015 GeoBasis-DE/BKG (©2009), Google",
     "legs" : [
        {
           "distance" : {
              "text" : "585 km",
              "value" : 584740
           },

依此类推。如您所见,您可以获得德国坐标的完整数据。

修改

好的.. CLLocationManager做同样的事情......我怎么能在这些国家获得地址?

1 个答案:

答案 0 :(得分:2)

{
- (void)mapView:(GMSMapView *)mapView idleAtCameraPosition:(GMSCameraPosition *)position
{
    CLLocation *pinLocation =[[CLLocation alloc] initWithLatitude:position.target.latitude  longitude:position.target.longitude];

CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:pinLocation
               completionHandler:^(NSArray *placemarks, NSError *error)
 {
     if (error)
     {
         return;
     }
     CLPlacemark *placemark = [placemarks objectAtIndex:0];
     NSLog(@"address-->%@",placemark.addressDictionary);

}];