【问题标题】:google geocoding api services with zip code 12593邮政编码为 12593 的谷歌地理编码 API 服务
【发布时间】:2020-12-25 17:52:46
【问题描述】:

我在使用 google 地理定位服务时遇到问题。本质上,我们将它用于邮政编码验证器,邮政编码“12593”存在问题。此邮政编码显示为在西班牙。 (请参见此处的屏幕截图 = http://prntscr.com/hkkafh

在这里查看xml https://maps.googleapis.com/maps/api/geocode/xml?&address=12593)

这个邮政编码虽然是美国的邮政编码,但可以在这里看到 = https://www.google.com/search?num=100&q=us+zip+code+12593&oq=us+zip+code+12593(谷歌搜索结果。)

我知道谷歌不是邮政编码的权威,但我希望谷歌明白这个邮政编码可能有两个不同的位置。

知道如何让 api 了解我正在寻找专门在美国的邮政编码?

【问题讨论】:

  • 这不是当前有效的邮政编码:smartystreets.com/products/… |你也可以在这里查看:tools.usps.com/go/…
  • 这是(数值上)12583 Nevis 12584 Vails Gate 12585 Verbank 12586 Walden 12588 Walker Valley 12589 Wallkill 12589 Wallkill 12590 Wappingvers 12592 wappers 12592 pody 12594 wingdeweeppoundy 12601 pody 12601 pody 12601 pody 12589 pogy 12594 pody 12601 pody and span 12583 nevis 12585 walley 12594 pody 12601 pody 12601,
  • 谢谢。没想到要检查 USPS,因为客户声称是他们的邮政编码并通过 Google 搜索找到。如果不是在 USPS,那我也没什么好担心的。谢谢

标签: google-geocoding-api


【解决方案1】:

地理编码 API 无法访问您尝试查找的邮政编码。这附近的人可以到达:

https://maps.googleapis.com/maps/api/geocode/json?&components=country:US|postal_code:12516

要按邮政编码搜索并按国家/地区(即美国)进行限制,您必须使用components 查询参数的子参数,如上面的 URL 中所示

...&components=country:US|postal_code:[YOUR PARAMETER]

(在https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering上得到这个参数信息)

【讨论】:

  • Jeffery 的评论对我更有帮助,但这回答了我的次要问题,即如何强制一个国家。谢谢
【解决方案2】:

您也可以使用https://thezipcodes.com/ 从帐户部分获取 API 密钥。点击获取请求。我在这里找到了大部分数据。

https://thezipcodes.com/api/v1/search?zipCode={zipCode}&countryCode={2digitCountryCode}&apiKey={apiKey}

反应会是这样的

{
    "success": true,
    "location": [{
      "zipCode": "13040",
      "country": "United States",
      "countryCode2": "US",
      "countryCode3": "USA",
      "state": "New York",
      "stateCode2": "NY",
      "city": "Cincinnatus",
      "county": "Cortland",
      "latitude": "42.564381",
      "longitude": "-75.934792",
      "timeZone": "EST — Eastern Standard Time"
    }]
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-25
    • 1970-01-01
    相关资源
    最近更新 更多