问题描述
我想使用我的空间数据集 (sp_ds
) 作为 ppp
(spatstat Point Pattern 对象) 用于完整的空间测试目的,我尝试这样做:
# Packages
library(spatstat)
library(sf)
library(sp)
library(raster) ## maybe a cause of pointDistance() function,not used yet
# Open spatial data set in GitHub
sp_ds<-read.csv("https://raw.githubusercontent.com/Leprechault/trash/master/myspds.csv")
str(sp_ds)
#'data.frame': 4458 obs. of 2 variables:
# $ Lat : num 9.17 9.71 9.12 9.12 9.71 ...
# $ Long: num 35.8 35.5 35.8 35.8 35.5 ...
# Create boudaries using sf
sfds = st_as_sf(sp_ds,coords=c("Long","Lat"),crs=4326)
traps<-sp_ds
ch <- chull(traps[,c(2,1)])
coords <- traps[c(ch,ch[1]),]
coordinates(coords) <- c("Long","Lat")
proj4string(coords) <- CRS("+init=epsg:4326")
W <- owin(poly=cbind(coordinates(coords)[,2],coordinates(coords)[,1]))
# Create a ppp Point Pattern object
out.ppp<-ppp(x=sp_ds$Lat,y=sp_ds$Long,window=W)
plot(out.ppp)
# Make a CRS test
f1 <- ppm(out.ppp~1)
E <-envelope(f1,Kinhom,nsim = 19,global = TRUE,correction = "border")
plot(E)
但我想以米为单位 r 距离(x 轴),为此我需要将 4326 的坐标参考系统转换为 UTM,但有 3 个 UTM 区域混合:
#34N bounds: (18.0,0.0,24.0,84.0)
#35N bounds: (24.0,30.0,84.0)
#36N bounds: (30.0,36.0,84.0)
请问,有没有一种简单的方法可以在 UTM 中创建一个独特的 ppp
对象,其中包含没有区域叠加的区域混合?
提前致谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)