Google maps 谷歌地图城市搜索
我们有一个自动完成字段,使用谷歌地图api自动填写城市详细信息字段 因此,使用“(cities)”作为类型,我们可以得到一个与搜索结果匹配的城市列表,但是数据不一致,而且澳大利亚的大城市缺少诸如邮政编码字段之类的内容。查找如下Google maps 谷歌地图城市搜索,google-maps,Google Maps,我们有一个自动完成字段,使用谷歌地图api自动填写城市详细信息字段 因此,使用“(cities)”作为类型,我们可以得到一个与搜索结果匹配的城市列表,但是数据不一致,而且澳大利亚的大城市缺少诸如邮政编码字段之类的内容。查找如下 this.autocomplete = new google.maps.places.Autocomplete((this.element), { types: ["(cities)"] , componentRestrictions: {country: ["au",
this.autocomplete = new google.maps.places.Autocomplete((this.element), { types: ["(cities)"] , componentRestrictions: {country: ["au","nz"]}});
所以,当你搜索城市时,比如“里士满”这样的郊区,你会得到以下的回答
/**/_xdc_._n1gyyx && _xdc_._n1gyyx( {
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Richmond",
"short_name" : "Richmond",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Yarra City",
"short_name" : "Yarra",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Victoria",
"short_name" : "VIC",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Australia",
"short_name" : "AU",
"types" : [ "country", "political" ]
},
{
"long_name" : "3121",
"short_name" : "3121",
"types" : [ "postal_code" ]
}
],
带有“邮政编码”和“地区”、“政治”
不过,在墨尔本搜索时,您可能会看到邮政编码为3000的详细信息,但您只能得到
/**/_xdc_._ntt86i && _xdc_._ntt86i( {
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Melbourne",
"short_name" : "Melbourne",
"types" : [ "colloquial_area", "locality", "political" ]
},
{
"long_name" : "Victoria",
"short_name" : "VIC",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Australia",
"short_name" : "AU",
"types" : [ "country", "political" ]
}
],
所以现在名称存储在“口语区”、“地方”、“政治”中,没有“邮政编码”
但是,当在自动完成中筛选墨尔本时,您得到的只是墨尔本选项或墨尔本机场,两者都不正确。如果您随后将类型更改为“(regions),则可以在返回正确墨尔本版本的邮政编码上搜索
是否有人遇到过这种情况,并找到了一种方法来强制过滤结果只显示带有邮政编码的版本?此行为按预期进行,因为像墨尔本这样的地方在其区域内有多个邮政编码(例如3977、3156、3806、3978等)因此,结果将不会返回邮政编码,因为它不能处理多个邮政编码,也不能返回单个邮政编码,因为它将影响信息的完整性,因为它将不适用于其余的邮政编码
您可以在中提交功能请求以请求处理多个邮政编码的此类功能。此行为按预期工作,因为墨尔本等地的区域内有多个邮政编码(例如3977、3156、3806、3978等)因此,结果将不会返回邮政编码,因为它不能处理多个邮政编码,也不能返回单个邮政编码,因为它将影响信息的完整性,因为它将不适用于其余的邮政编码
您可以在中提交功能请求以请求处理多个邮政编码的此类功能。大城市没有唯一的邮政编码大城市没有唯一的邮政编码