Find in which country each point-coordinate belongs to [duplicate]

狂风中的少年 提交于 2019-12-24 04:34:32

问题


I have a data frame with lat/lon coordinates:

head(COORD)
   LAT   LON 
1  69.34 16.17  
2  69.20 17.92   
3  69.59 17.87 
4  69.17 18.52  
5  69.42 18.95 
6  69.22 18.91 

I would like to to retrieve the country name of each point and add it as a third column. Maybe using which in combination with map to retrieve in which polygon the points are but I was not able to figure out how.


回答1:


Try using map.where()

library(maps)

COORD$Country <- map.where(database="world", COORD$LON, COORD$LAT)


来源:https://stackoverflow.com/questions/17301608/find-in-which-country-each-point-coordinate-belongs-to

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!