与此主题相关的两个问题。首先,以样本地址“方桥社区居委会”为例,我先直接在谷歌地图上查了一下,我得到了它的位置和英文翻译“方桥社区居委会”。但是,当我尝试运行代码时
library(googleway)
key <- 'APIkey'
google_geocode(address = "方桥社区居委会", language = "CN", key = key)
我从上面的中文地址得到的结果是
$results
address_components
1 Xinhai Avenue, Yaohai Qu, Hefei Shi, Anhui Sheng, China, Xinhai Ave, Yaohai
Qu, Hefei Shi, Anhui Sheng, CN, route, political, sublocality,
sublocality_level_1, locality, political, administrative_area_level_1,
political, country, political
formatted_address geometry.location.lat
1 Xinhai Ave, Yaohai Qu, Hefei Shi, Anhui Sheng, China 31.89561
geometry.location.lng geometry.location_type
geometry.viewport.northeast.lat
1 117.3393 APPROXIMATE
31.89696
geometry.viewport.northeast.lng geometry.viewport.southwest.lat
1 117.3407 31.89426
geometry.viewport.southwest.lng place_id
1 117.338 ChIJ2attw2plyzUR782Meh0Xnvs
types
1 establishment, point_of_interest
$status
[1] "OK"
我无法获得其邮政编码信息。当我使用以下代码时
google_geocode(address = "Fangqiao Community Residents' Committee", language = "CN", key = key)
我可以得到它的邮政编码信息。
$results
address_components
1 Jiangdu Road, Guangling Qu, Yangzhou Shi, Jiangsu Sheng, China, 225009,
Jiangdu Rd, Guangling Qu, Yangzhou Shi, Jiangsu Sheng, CN, 225009, route,
political, sublocality, sublocality_level_1, locality, political,
administrative_area_level_1, political, country, political, postal_code
formatted_address
1 Jiangdu Rd, Guangling Qu, Yangzhou Shi, Jiangsu Sheng, China, 225009
geometry.location.lat geometry.location.lng geometry.location_type
1 32.39118 119.4622 APPROXIMATE
geometry.viewport.northeast.lat geometry.viewport.northeast.lng
1 32.39253 119.4635
geometry.viewport.southwest.lat geometry.viewport.southwest.lng
partial_match
1 32.38983 119.4608
TRUE
place_id types
1 ChIJcQhNY82HtjURw8QwBzgCGgA establishment, point_of_interest
$status
[1] "OK"
为什么有区别?我可以知道这个包是如何工作的或者谷歌地图是如何工作的,我可以通过什么方式确定中国的一个位置的邮政编码?