使用 componentRestrictions 时的特定地理编码错误
Specific geocoding error when using componentRestrictions
当我尝试在地理编码时使用 componentRestrictions 时:
geocoder.geocode({
address: address,
componentRestrictions: {
country: 'AU',
},
}
为了:
address = 'Sydney 2000'
(区分大小写)
我得到:
{
"results" : [],
"status" : "ZERO_RESULTS"
}
然而,`address = 'sydney 2000'`
给我悉尼的正常结果对象
(也适用于格式为 'Melbourne 3000' 的基本上所有其他澳大利亚首府城市)
而如果我使用地区:
geocoder.geocode({
address: address,
region: 'AU'
}
再次使用 `address = 'Sydney 2000'`(区分大小写)给我悉尼的正常结果对象
除了 Sydney 2000
之外,我还没有看到任何失败。因此,虽然我可以选择解决这个问题,但我也很困惑为什么它不起作用。
您遇到的问题似乎是 Google 问题跟踪器
中报告的已知问题
4-digit postal codes are hard to geocode (AT, AU, BE, CH, DK, NZ, SI)
据 Google
的工程师说
We are investigating a systemic issue that appears to make postal codes with 4 digits particularly difficult to find in the Geocoding API.
For best result, the recommended request format is to use Component Filtering and Region Biasing towards the desired country:
https://maps.googleapis.com/maps/api/geocode/json?skip_auth&components=postal_code:2725|country:AU®ion=AU
In Australia in particular, if feasible in your implementation, adding the administrative_area: filter helps with most postal codes in the 2000-2020 range.
(taking into account that postal codes 2001-2005 and 2012-2014 are not in Google Maps at all)
https://maps.googleapis.com/maps/api/geocode/json?&components=country:AU|administrative_area:NSW|postal_code:2006
In other countries, wherever possible adding the locality filter would also help, as noted in #10.
We will keep you posted here.
我建议阅读所有 bug 的消息并为该 bug 加注星标,以便订阅来自 Google 的进一步通知。
当我尝试在地理编码时使用 componentRestrictions 时:
geocoder.geocode({
address: address,
componentRestrictions: {
country: 'AU',
},
}
为了:
address = 'Sydney 2000'
(区分大小写)
我得到:
{
"results" : [],
"status" : "ZERO_RESULTS"
}
然而,`address = 'sydney 2000'`
给我悉尼的正常结果对象
(也适用于格式为 'Melbourne 3000' 的基本上所有其他澳大利亚首府城市)
而如果我使用地区:
geocoder.geocode({
address: address,
region: 'AU'
}
再次使用 `address = 'Sydney 2000'`(区分大小写)给我悉尼的正常结果对象
除了 Sydney 2000
之外,我还没有看到任何失败。因此,虽然我可以选择解决这个问题,但我也很困惑为什么它不起作用。
您遇到的问题似乎是 Google 问题跟踪器
中报告的已知问题4-digit postal codes are hard to geocode (AT, AU, BE, CH, DK, NZ, SI)
据 Google
的工程师说We are investigating a systemic issue that appears to make postal codes with 4 digits particularly difficult to find in the Geocoding API.
For best result, the recommended request format is to use Component Filtering and Region Biasing towards the desired country:
https://maps.googleapis.com/maps/api/geocode/json?skip_auth&components=postal_code:2725|country:AU®ion=AU
In Australia in particular, if feasible in your implementation, adding the administrative_area: filter helps with most postal codes in the 2000-2020 range. (taking into account that postal codes 2001-2005 and 2012-2014 are not in Google Maps at all)
https://maps.googleapis.com/maps/api/geocode/json?&components=country:AU|administrative_area:NSW|postal_code:2006
In other countries, wherever possible adding the locality filter would also help, as noted in #10.
We will keep you posted here.
我建议阅读所有 bug 的消息并为该 bug 加注星标,以便订阅来自 Google 的进一步通知。