【问题标题】:How to get suburbs by postcode?如何通过邮政编码获得郊区?
【发布时间】:2020-01-22 18:19:19
【问题描述】:

我按邮政编码搜索 http://autocomplete.geocoder.api.here.com/6.2/suggest.json?app_id=API_ID&app_code=APP_CODE&query=3084&country=AUS

预期结果将是所有郊区(Viewbank、Rosanna、Heidelberg ...)的邮政编码为 3084,但结果通常是墨尔本,这些建议无济于事:

{
    "suggestions": [
        {
            "label": "Australia, VIC, 3084, Melbourne",
            "language": "en",
            "countryCode": "AUS",
            "locationId": "NT_XPjzlLh3Twzu3wr29Eo-cD",
            "address": {
                "country": "Australia",
                "state": "VIC",
                "city": "Melbourne",
                "postalCode": "3084"
            },
            "matchLevel": "postalCode"
        }
    ]
}

以下结果(来自我本地 elasticsearch 中的地址安装,而不是来自 hereapi)是预期结果:

"suggestions":[  
         {  
            "source":{  
               "postcode":"3084",
            },
            "type":"postcode",
            "display":{  
               "text":"3084"
            }
         },
         {  
            "source":{  
               "postcode":"3084",
               "state":"VIC",
               "name":"Viewbank"
            },
            "type":"suburb",
            "display":{  
               "text":"Viewbank, VIC 3084"
            }
         },
         {  
            "source":{  
               "postcode":"3084",
               "state":"VIC",
               "name":"Heidelberg"
            },
            "type":"suburb",
            "display":{  
               "text":"Heidelberg, VIC 3084"
            }
         },
         {  
            "source":{  
               "postcode":"3084",
               "state":"VIC",
               "name":"Rosanna"
            },
            "type":"suburb",
            "display":{  
               "text":"Rosanna, VIC 3084"
            }
         },
         {  
            "source":{  
               "postcode":"3084",
               "state":"VIC",
               "name":"Eaglemont"
            },
            "type":"suburb",
            "display":{  
               "text":"Eaglemont, VIC 3084"
            }
         }
      ]

【问题讨论】:

  • 请与我们分享您的尝试
  • 我改变了我的问题,添加了第一次尝试使用这里 api 和第二次尝试使用地址(另一个提供者)
  • 你可以试试这样,看看结果是否符合你的期望:autocomplete.geocoder.api.here.com/6.2/…

标签: javascript here-api here-autocomplete


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 2020-04-21
  • 1970-01-01
  • 1970-01-01
  • 2023-03-06
  • 1970-01-01
  • 1970-01-01
  • 2018-07-23
  • 1970-01-01
相关资源
最近更新 更多