【问题标题】:Find in which country each point-coordinate belongs to [duplicate]查找每个点坐标属于哪个国家[重复]
【发布时间】:2013-06-22 12:03:29
【问题描述】:

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

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 

我想检索每个点的国家名称并将其添加为第三列。 也许使用which 结合map 来检索点在哪个多边形中,但我无法弄清楚如何。

【问题讨论】:

    标签: r geolocation maps


    【解决方案1】:

    尝试使用 map.where()

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

    【讨论】:

    • 你可能想指定map.where函数在哪个包中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-24
    • 2021-12-04
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 2012-06-20
    • 1970-01-01
    相关资源
    最近更新 更多