【问题标题】:Google geocode API not returning result for certain locations谷歌地理编码 API 不返回某些位置的结果
【发布时间】:2014-03-17 05:58:52
【问题描述】:

Google Geocode API 未返回某些位置的结果。其中之一是

Perkins Restaurant & Bakery, East Fowler Ave, Tampa, FL

以下是此位置的 API 返回结果链接。

https://maps.googleapis.com/maps/api/geocode/json?address=Perkins%20Restaurant%20&%20Bakery,%20E%20Fowler%20Ave,%20Tampa,%20FL,%20United%20States&sensor=true

有人遇到过这个问题吗?我不提供components 参数,因此搜索结果不应局限于任何地理区域。

【问题讨论】:

标签: php android ios google-api google-geocoding-api


【解决方案1】:

"您需要将地址参数中的 & 替换为其 URL 编码 %26"

https://stackoverflow.com/a/6979738/189804

使用 & 符号:

{ "results" : [], "status" : "ZERO_RESULTS" }

使用 %26 编码:

    {
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "2301",
               "short_name" : "2301",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "East Fowler Avenue",
... and so on ...

【讨论】:

  • %26 替换& 有效,但转义所有字符无效。 place = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (__bridge CFStringRef) place, NULL, CFSTR("!*'();:@&=+$,/?%#[]\" "), kCFStringEncodingUTF8));你能解释一下这是为什么吗?
  • 我必须查看 Google API 文档以了解要求是什么,并且只逃避他们所说的逃避。
猜你喜欢
  • 2012-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-21
  • 1970-01-01
  • 1970-01-01
  • 2013-08-28
相关资源
最近更新 更多