查找每个点坐标属于哪个国家 [英] Find in which country each point-coordinate belongs to

查看:79
本文介绍了查找每个点坐标属于哪个国家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个经纬度坐标的数据框:

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 

我想检索每个点的国家/地区名称并将其添加为第三列. 也许结合使用whichmap来检索点在哪个多边形中,但是我无法弄清楚该怎么做.

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.

推荐答案

尝试使用map.where()

Try using map.where()

library(maps)

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

这篇关于查找每个点坐标属于哪个国家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆