繁体   English   中英

R:根据坐标将对应ID的多边形分配给shapefile中的点

[英]R: Assign corresponding ID's polygon to points in shapefile according to coordinates

我有两个shapefile。 第一个是区域的多边形shapefile,每个区域都有唯一的ID。 第二个是点shapefile,事件在shapefile1的区域中发生。

我想为点shapefile的每个事件(行)分配多边形shapefile的相应区域ID。

关于如何使用R执行此操作的任何想法?

提前致谢。

为此,您应该可以使用over()

Points_w_Region <- over(points,regions) ## Get the information
Points$regions <- Points_w_Region ## Assign the information to the data

这样会将获得的区域分配给每个点。 over()是sp程序包的一部分,我假设您的数据在sp结构内。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM