【发布时间】:2020-10-01 23:22:52
【问题描述】:
您好所有潜在的帮助者,
我有一个从tigris 包中获得的SpatialPolygonDataFrame 对象,我想在创建ppp 对象时将其用作多边形窗口。这是我尝试过的:
# Needed packages
library(spatstat)
library(sf)
# Download geospatial data for Lee county in Alabama (home of the great Auburn University by the way!)
county <- tigris::county_subdivisions(state = "Alabama", county = "Lee")
# The polygon of Lee county is subdivided, so I convert it to a single polygon after converting it to an sf object
county_sf <- st_as_sf(county)
county_one <- st_union(county_sf)
# A quick plot of the object outputs what I am expecting
plot(county_one)
# Now I create a planar point pattern and I use county_one as the window
p <- ppp(x = -85.4, y = 32.5, window = as.owin((county_one)))
# But the plot here shows that the window is just a rectangle and not the polygon :(
plot(p)
感谢您的帮助。
【问题讨论】:
-
这只是在制作中。请参阅github.com/r-spatial/sf/issues/1233 了解更多信息
标签: r geospatial sf spatstat