Json gmap api地理代码zipcode沙特阿拉伯未按预期工作

Json gmap api地理代码zipcode沙特阿拉伯未按预期工作,json,google-maps,google-geocoder,Json,Google Maps,Google Geocoder,使用GoogleMapAPI获取Zipcode的边界和坐标 在对沙特阿拉伯(SA)地区的地址进行地理编码时,当对沙特阿拉伯(SA)的Zipcode进行地理编码时,地理编码器的结果具有指向荷兰海牙2517的地址 { "results" : [ { "address_components" : [ { "long_name" : "2517", "short_name" : "25

使用GoogleMapAPI获取Zipcode的边界和坐标

在对沙特阿拉伯(SA)地区的地址进行地理编码时,当对沙特阿拉伯(SA)的Zipcode进行地理编码时,地理编码器的结果具有指向荷兰海牙2517的地址

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "2517",
               "short_name" : "2517",
               "types" : [ "postal_code", "postal_code_prefix" ]
            },
            {
               "long_name" : "The Hague",
               "short_name" : "The Hague",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "The Hague",
               "short_name" : "The Hague",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "South Holland",
               "short_name" : "ZH",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Netherlands",
               "short_name" : "NL",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "2517 The Hague, Netherlands",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 52.0958783,
                  "lng" : 4.3007563
               },
               "southwest" : {
                  "lat" : 52.0773935,
                  "lng" : 4.2732776
               }
            },
            "location" : {
               "lat" : 52.0847639,
               "lng" : 4.2801843
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 52.0958783,
                  "lng" : 4.3007563
               },
               "southwest" : {
                  "lat" : 52.0773935,
                  "lng" : 4.2732776
               }
            }
         },
         "place_id" : "ChIJI9DHzc6wxUcR1s1th0GbWgQ",
         "types" : [ "postal_code", "postal_code_prefix" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "2517",
               "short_name" : "2517",
               "types" : [ "postal_code" ]
            },
            {
               "long_name" : "Russell Vale",
               "short_name" : "Russell Vale",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Wollongong City Council",
               "short_name" : "Wollongong",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "New South Wales",
               "short_name" : "NSW",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Australia",
               "short_name" : "AU",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Russell Vale NSW 2517, Australia",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : -34.3338503,
                  "lng" : 150.9245951
               },
               "southwest" : {
                  "lat" : -34.3654418,
                  "lng" : 150.8740632
               }
            },
            "location" : {
               "lat" : -34.3454996,
               "lng" : 150.9016476
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : -34.3338503,
                  "lng" : 150.9245951
               },
               "southwest" : {
                  "lat" : -34.3654418,
                  "lng" : 150.8740632
               }
            }
         },
         "place_id" : "ChIJSaEBIk8eE2sRQIa6P2t9ARw",
         "postcode_localities" : [ "Russell Vale", "Woonona" ],
         "types" : [ "postal_code" ]
      }
   ],
   "status" : "OK"
}
由于结果与沙特阿拉伯无关,因此在api中增加了国家限制。但是它的结果有部分结果,这表示结果不准确,它的结果只有沙特阿拉伯位置的默认值

但是当街道/地区的地址添加Zipcode时,地理编码就起作用了


是否有办法强制Gmap api仅使用zipcode对沙特阿拉伯国家进行地理编码,结果是准确的坐标和边界?

看起来沙特阿拉伯的邮政编码覆盖率不太好

您可以使用搜索工具搜索邮政编码,但对于缺少的邮政编码,您通常会得到零搜索结果

比如说,

返回邮政编码,但

返回零结果

对于丢失的邮政编码,您可以使用maps.google.com右下角的“发送反馈”链接


希望有帮助

在我看来,地理编码器的数据库不包括2517作为沙特阿拉伯的有效邮政编码。这是一个有效的邮政编码吗(对我来说好像没有足够的数字)?如果是这样,您可能需要转到谷歌地图“mapmaker”并添加它。(注意:您发布的邮件返回邮政编码55425)谢谢,请在下面的链接中找到沙特阿拉伯的邮政编码。当使用本页中列出的任何Zipcode时,Google geocode的结果与预期不符。
{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Saudi Arabia",
               "short_name" : "SA",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Saudi Arabia",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 32.1542839,
                  "lng" : 55.6666999
               },
               "southwest" : {
                  "lat" : 16.379528,
                  "lng" : 34.5489978
               }
            },
            "location" : {
               "lat" : 23.885942,
               "lng" : 45.079162
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 32.1542839,
                  "lng" : 55.6666999
               },
               "southwest" : {
                  "lat" : 16.379528,
                  "lng" : 34.5489978
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJQSqV5z-z5xURm7YawktQYFk",
         "types" : [ "country", "political" ]
      }
   ],
   "status" : "OK"
}