如何在R中通过ggmap包获取邮政编码数据集
通过使用如何在R中通过ggmap包获取邮政编码数据集,r,ggmap,R,Ggmap,通过使用geocode('Zip')我可以得到位置坐标。 给定坐标,我能得到那个位置的邮政编码吗? 比如说 geocode('130022,长春') 这给了我家乡的坐标。130022是邮政编码,长春 这就是城市。通过这样做,我想得到唯一的地理坐标长春 城市,这是(125.35,43.86364)。 如果我给出了坐标,我如何才能取回邮政编码数据呢?使用revgeocode() 如果需要更多详细信息,请指定output='all' res <- revgeocode(location = c
geocode('Zip')
我可以得到位置坐标。
给定坐标,我能得到那个位置的邮政编码吗?
比如说
geocode('130022,长春')
这给了我家乡的坐标。130022是邮政编码,长春 这就是城市。通过这样做,我想得到唯一的地理坐标长春 城市,这是(125.35,43.86364)。
如果我给出了坐标,我如何才能取回邮政编码数据呢?使用revgeocode()
如果需要更多详细信息,请指定output='all'
res <- revgeocode(location = c(125.35, 43.8634), output = 'all')
str(res)
# List of 2
# $ results:List of 6
# ..$ :List of 5
# .. ..$ address_components:List of 6
# .. .. ..$ :List of 3
# .. .. .. ..$ long_name : chr "Jun Zhuan Hu Tong"
# .. .. .. ..$ short_name: chr "Jun Zhuan Hu Tong"
# .. .. .. ..$ types : chr "route"
# .. .. ..$ :List of 3
# .. .. .. ..$ long_name : chr "Nanguan Qu"
# .. .. .. ..$ short_name: chr "Nanguan Qu"
# .. .. .. ..$ types : chr [1:3] "political" "sublocality" "sublocality_level_1"
# .. .. ..$ :List of 3
# .. .. .. ..$ long_name : chr "Changchun Shi"
# .. .. .. ..$ short_name: chr "Changchun Shi"
# .. .. .. ..$ types : chr [1:2] "locality" "political"
# .. .. ..$ :List of 3
# .. .. .. ..$ long_name : chr "Jilin Sheng"
# .. .. .. ..$ short_name: chr "Jilin Sheng"
# .. .. .. ..$ types : chr [1:2] "administrative_area_level_1" "political"
# ... etc
res
res <- revgeocode(location = c(125.35, 43.8634), output = 'all')
str(res)
# List of 2
# $ results:List of 6
# ..$ :List of 5
# .. ..$ address_components:List of 6
# .. .. ..$ :List of 3
# .. .. .. ..$ long_name : chr "Jun Zhuan Hu Tong"
# .. .. .. ..$ short_name: chr "Jun Zhuan Hu Tong"
# .. .. .. ..$ types : chr "route"
# .. .. ..$ :List of 3
# .. .. .. ..$ long_name : chr "Nanguan Qu"
# .. .. .. ..$ short_name: chr "Nanguan Qu"
# .. .. .. ..$ types : chr [1:3] "political" "sublocality" "sublocality_level_1"
# .. .. ..$ :List of 3
# .. .. .. ..$ long_name : chr "Changchun Shi"
# .. .. .. ..$ short_name: chr "Changchun Shi"
# .. .. .. ..$ types : chr [1:2] "locality" "political"
# .. .. ..$ :List of 3
# .. .. .. ..$ long_name : chr "Jilin Sheng"
# .. .. .. ..$ short_name: chr "Jilin Sheng"
# .. .. .. ..$ types : chr [1:2] "administrative_area_level_1" "political"
# ... etc