在https://autocomplete.geocoder.api.here.com/6.2/suggest.json?query=search_string寻求建议时 对于以下字符串:“韩国”,“中国”,“埃及”,“阿拉伯联合酋长国”,结果很奇怪:出现了一些晦涩的地址,但没有国家。更可笑的是,“苏丹”给予“南苏丹”作为一个国家,但没有给予(北)苏丹。这是应该的吗?例如,“韩国”的结果为:
{
"suggestions": [
{
"label": "United States, NY, New York, Koreatown",
"language": "en",
"countryCode": "USA",
"locationId": "NT_7wUYOjyc5nhxpMHPtLSTuB",
"address": {
"country": "United States",
"state": "NY",
"county": "New York",
"city": "New York",
"district": "Koreatown",
"postalCode": "10001"
},
"matchLevel": "district"
},
{
"label": "United States, NY, Airmont, Korean War Veterans Memorial Hwy",
"language": "en",
"countryCode": "USA",
"locationId": "NT_kA6TbLAbwsSLEA8vabyxDB",
"address": {
"country": "United States",
"state": "NY",
"county": "Rockland",
"city": "Airmont",
"street": "Korean War Veterans Memorial Hwy",
"postalCode": "10901"
},
"matchLevel": "street"
},
{
"label": "United States, OH, Piqua, Korean War Veterans Memorial Hwy",
"language": "en",
"countryCode": "USA",
"locationId": "NT_vccsaqFIU9eMsXqxfj0UMA",
"address": {
"country": "United States",
"state": "OH",
"county": "Miami",
"city": "Piqua",
"street": "Korean War Veterans Memorial Hwy",
"postalCode": "45356"
},
"matchLevel": "street"
},
{
"label": "United States, NY, Spring Valley, Korean War Veterans Memorial Hwy",
"language": "en",
"countryCode": "USA",
"locationId": "NT_oWAdxNTgggvSioBhhX7LAD",
"address": {
"country": "United States",
"state": "NY",
"county": "Rockland",
"city": "Spring Valley",
"street": "Korean War Veterans Memorial Hwy",
"postalCode": "10977"
},
"matchLevel": "street"
}
]
}
远远超出了人们的预期。
答案 0 :(得分:0)
https://autocomplete.geocoder.api.here.com处的API是 Geocoder自动填充API ,可用于自动填充地址。
Places Search API似乎更适合您的需求。
例如,以下带有查询字符串“ korea ”的请求将返回韩国,朝鲜和韩国(看起来印度有一个行政区叫该名称):
curl \
-H 'X-Map-Viewport:-2.8666,-32.6068,176.4302,65.5563' \
--get 'https://places.api.here.com/places/v1/autosuggest' \
--data-urlencode 'app_code={{APP_CODE}}' \
--data-urlencode 'app_id={{APP_ID}}' \
--data-urlencode 'pretty=true' \
--data-urlencode 'q=korea' \
--data-urlencode 'result_types=place' \
--data-urlencode 'size=5'