通过 HERE 自动完成 API 搜索英国地址会返回缩短的邮政编码(与单位相关的最后 2 个符号被删除)。 搜索完整的邮政编码会返回正确的地址,并且 HERE 地图也能够找到完整的邮政编码。
我正在查询地址“Choyce Close 38”:
GET https://autocomplete.search.hereapi.com/v1/autocomplete?apiKey=&q=choyce%20close%2038&lang=en&limit=1
{
"items": [
{
"title": "United Kingdom, LE67 3, Coalville, 38 Choyce Close",
"id": "here:af:streetsection:E77KSGCrId.g46fwNvmTSC:CggIBCDom-OxAxABGgIzOA",
"language": "en",
"resultType": "houseNumber",
"houseNumberType": "PA",
"address": {
"label": "38 Choyce Close, Coalville, LE67 3, United Kingdom",
"countryCode": "GBR",
"countryName": "United Kingdom",
"state": "England",
"countyCode": "LEC",
"county": "Leicestershire",
"city": "Coalville",
"district": "Coalville",
"street": "Choyce Close",
"postalCode": "LE67 3",
"houseNumber": "38"
},
"highlights": {
"title": [
{
"start": 35,
"end": 37
},
{
"start": 38,
"end": 50
}
],
"address": {
"label": [
{
"start": 0,
"end": 2
},
{
"start": 3,
"end": 15
}
],
"street": [
{
"start": 0,
"end": 12
}
],
"houseNumber": [
{
"start": 0,
"end": 2
}
]
}
}
}
]
}
返回的邮政编码是“LE67 3”。
虽然英国正确且常见的邮政编码是“LE67 3SS” https://www.doogal.co.uk/ShowMap?postcode=LE67%203SS
搜索完整邮政编码会返回地址:
GET https://autocomplete.search.hereapi.com/v1/autocomplete?apiKey=&q=LE67%203SS&lang=en&limit=1
{
"items": [
{
"title": "United Kingdom, Coalville, LE67 3SS Choyce Close",
"id": "here:af:streetsection:E77KSGCrId.g46fwNvmTSC:EAMyCGxlNjd8M3Nz",
"language": "en",
"resultType": "postalCodePoint",
"address": {
"label": "LE67 3SS Choyce Close, Coalville, United Kingdom",
"countryCode": "GBR",
"countryName": "United Kingdom",
"state": "England",
"countyCode": "LEC",
"county": "Leicestershire",
"city": "Coalville",
"district": "Coalville",
"street": "Choyce Close",
"postalCode": "LE67 3SS"
},
"highlights": {
"title": [
{
"start": 27,
"end": 35
}
],
"address": {
"label": [
{
"start": 0,
"end": 8
}
],
"postalCode": [
{
"start": 0,
"end": 8
}
]
}
}
}
]
}
我需要的是在搜索街道名称+建筑物时返回正确的完整邮政编码
不幸的是,这个特定问题在不久的将来不会得到解决,因为目前我们没有可用的来源将完整版本的邮政编码 LE67 3SS 链接到 38 Choyce Close。
我们拥有的来源不包括有问题的道路,这意味着我们无法提供链接,进一步意味着自动完成 API 将继续返回之前显示的结果 (LE67 3)。
我们将完整的邮政编码作为英国完整邮政编码产品的一部分,并且我们在核心地图中拥有完整的点地址覆盖范围。我们现在正在探索不同的方法来尝试创建我们自己的覆盖范围,以帮助消除地理编码和搜索 v7 服务中的此类问题,这可能需要更多时间并且尚未得到保证。
现在可以了。 HERE 自动完成功能返回地址的完整英国邮政编码。 “q=Choyce Close 38”返回邮政编码为 LE67 3SS 的地址。 “q=10 Downing St London”返回邮政编码为 SW1A 2AA 的地址。