1

我正在尝试导出为家庭范围数据创建的多边形,但是当我导出它们时会收到以下错误消息:

Error in writeOGR(colkud95[1, ], ".", "colonyhomerange", driver = "ESRI Shapefile") : 
  Spatial Polygons objects should have valid ordering comments
use rgeos::createSPComment()
dput(HRtracks[1:10, ])
new("SpatialPointsDataFrame", data = structure(list(TripID = c(1, 
1, 1, 1, 1, 1, 1, 1, 1, 1), `Breeding stage` = c(1, 1, 1, 1, 
1, 1, 1, 1, 1, 1)), row.names = c(NA, -10L), class = c("tbl_df", 
"tbl", "data.frame")), coords.nrs = 1:2, coords = structure(c(174.78327, 
174.78326, 174.78332, 174.78323, 174.78325, 174.78277, 174.78238, 
174.78238, 174.78244, 174.78278, -41.09482, -41.09491, -41.09484, 
-41.09491, -41.09496, -41.09564, -41.09637, -41.09685, -41.09747, 
-41.09771), .Dim = c(10L, 2L), .Dimnames = list(NULL, c("x", 
"y"))), bbox = structure(c(174.78238, -41.09771, 174.78332, -41.09482
), .Dim = c(2L, 2L), .Dimnames = list(c("x", "y"), c("min", "max"
))), proj4string = new("CRS", projargs = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs"))

#main package for this analysis
library(adehabitatHR)  
library(sp)
library(readxl)
library(rgdal)

HRtracks<-read_excel("allinterpolatedtracks.xlsx") 
coordinates(HRtracks)<-c("x","y") 
proj4string(HRtracks)<- CRS("+init=epsg:3857")
#Organising variable 1 refers to Trip ID
colkud<-kernelUD(tracks.utm[,1],h="href", grid=1000,same4all=T)
#Organising variable 2 refers to Breeding stage
colkudb<-kernelUD(tracks.utm[,2],h="href", grid=1000,same4all=T)
kernel.area(colkud,percent=50)
kernel.area(colkudb,percent=50)
kernel.area(colkud,percent=95)
kernel.area(colkudb,percent=95)
colkud95<- getverticeshr(colkud, percent=95)
colkud95b<- getverticeshr(colkudb, percent=95)
colkud50b<- getverticeshr(colkudb, percent=50)
colkud50<- getverticeshr(colkud, percent=50)
#This is where the error occurs
writeOGR(colkud95,".",layer="colkud95",driver="ESRI Shapefile")

我没有任何运气来寻找这个问题的答案,我的目标是为家庭范围创建多边形,然后将它们导出为要在 QGIS 中使用的 shapefile。

4

0 回答 0