【问题标题】:Select polygons intersecting (or completely within) another polygon [R sf]选择与另一个多边形相交(或完全在其中)的多边形 [R sf]
【发布时间】:2020-05-26 17:13:16
【问题描述】:

我想从一个简单的特征集合中选择与另一个 sf 集合中的多边形相交的多边形。这是一个可重现的示例:

library(sf)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
nc <- st_transform(nc,32717);nc
poly <- nc[1,]
fishnet<-st_make_grid(st_as_sfc(st_bbox(poly)),cellsize=5000)

现在,在创建了 poly 和围绕它的渔网之后,我想选择那些与 poly 相交或完全被 poly 包含的渔网单元。

感谢您的帮助!

标记

【问题讨论】:

  • 您是否尝试过使用sf::st_intersection()

标签: r intersection sf


【解决方案1】:
fishnet2 <- fishnet[poly,]

还有一个情节

library(ggplot2)

ggplot() + 
  geom_sf(data = poly, fill = "blue") +
  geom_sf(data = fishnet2, color = "red", fill = NA)

【讨论】:

  • 嗨,Eugene,效果很好,感谢您的帮助!
猜你喜欢
  • 2018-03-09
  • 2017-06-02
  • 2019-11-22
  • 1970-01-01
  • 2020-02-23
  • 2019-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多