这些似乎不是partial_matches
,所以我想知道为什么它没有带回所有的数据,特别是postal_code
。你知道吗
仔细检查谷歌地图,这就是我想要的确切地址。换句话说,这是直接的打击。你知道吗
Python代码:
address = '34 new street, Green road, Carlow'
geocode_url = "https://maps.googleapis.com/maps/api/geocode/json?address={}&key={}".format(address,api_key)
# Ping google for the reuslts:
results = requests.get(geocode_url)
# Results will be in JSON format - convert to dict using requests functionality
results = results.json()
以及结果。这里应该有postal_code
数据,对吧?没什么好说的,那只是部分匹配。你知道吗
{'results': [{'address_components': [{'long_name': '34',
'short_name': '34',
'types': ['street_number']},
{'long_name': 'New Street', 'short_name': 'New St', 'types': ['route']},
{'long_name': 'Moanacurragh',
'short_name': 'Moanacurragh',
'types': ['neighborhood', 'political']},
{'long_name': 'Carlow',
'short_name': 'Carlow',
'types': ['locality', 'political']},
{'long_name': 'County Carlow',
'short_name': 'County Carlow',
'types': ['administrative_area_level_1', 'political']},
{'long_name': 'Ireland',
'short_name': 'IE',
'types': ['country', 'political']}],
'formatted_address': '34 New St, Moanacurragh, Carlow, Ireland',
'geometry': {'location': {'lat': 52.8296466, 'lng': -6.9331115},
'location_type': 'RANGE_INTERPOLATED',
'viewport': {'northeast': {'lat': 52.83099558029149,
'lng': -6.931762519708498},
'southwest': {'lat': 52.82829761970849, 'lng': -6.934460480291502}}},
'place_id': 'EhozNCBOZXcgU3QsIENhcmxvdywgSXJlbGFuZCIaEhgKFAoSCZ93HqizQl1IEZZMDB0YIkdXECI',
'types': ['street_address']}],
'status': 'OK'}
现在,如果我在官方zipcode数据库(爱尔兰)中输入完全相同的字符串,它将返回zipcode。你知道吗
官方数据库是here顺便说一下,你可以试试地址字符串'34 new street, Green road, Carlow'
关于“34 new street,Green road,Carlow”的样品申请,您应该注意两点。你知道吗
如您所见,结果具有
RANGE_INTERPOLATED
位置类型,而不是ROOFTOP
。这意味着谷歌在其数据库中没有确切的地址,他们试图根据其他现有功能猜测(插入)地址的位置。如果对插值点(52.8296466,-6.9331115)和位置类型邮政编码
https://maps.googleapis.com/maps/api/geocode/json?latlng=52.8296466%2C-6.9331115&result_type=postal_code&key=YOUR_API_KEY
执行反向地理编码请求,您将得到以下响应你知道吗{ “加号”:{ “复合编码”:“R3H8+VQ Carlow,County Carlow,Ireland”, “全局代码”:“9C4MR3H8+VQ” }, “结果”:[ ], “status”:“零结果” }
所以,在Google数据库中没有包含点(52.8296466,-6.9331115)的邮政编码多边形。你正面临谷歌方面的数据问题。你知道吗
我建议联系谷歌数据团队,并在他们的帮助中心报告数据问题:
https://support.google.com/maps/answer/6320846
希望谷歌能尽快修复。你知道吗
相关问题 更多 >
编程相关推荐