Adehabitathr:在ProJ4String(XY)中:CRS对象有评论,输出丢失

发布于 2025-01-29 02:19:40 字数 1520 浏览 3 评论 0原文

我正在尝试从点数据中创建内核密度映射(以.shp.csv)为5种不同的物种,在全球范围内。对于某些人来说,只有一个地方,但是对于其他人来说,几乎没有几个点。我将使用KDE的输出图来识别热点。我正在使用adehabitathr以下产生KDE映射:

library("sp")
library("rgdal")
library("rgeos")
 
# load the data layer
data.Points <- readOGR("D:/FGH/merged","data")

#Defining a CRS with sp cause coordinate reference systems are represented differently when PROJ < 6 and PROJ >= 6.
crs_wgs84 <- CRS(SRS_string = "EPSG:4326") # WGS 84 has EPSG code 4326
class(crs_wgs84)
wkt_wgs84 <- wkt(crs_wgs84)
cat(wkt_wgs84)

#Set the CRS of a Spatial* object in sp
data.Points2 <- data.Points
coordinates(data.Points2) <-  ~ x + y
slot(data.Points2, "proj4string") <- crs_wgs84
    
library(raster)
library(adehabitatHR)
    
# Define the Domain               
x <- seq(-179.8300, 179.2461, by=0.083333333) # resolution is the pixel size you desire
y <- seq(-42, 52, by=0.083333333)
xy <- expand.grid(x=x,y=y)
coordinates(xy) <- ~x+y
gridded(xy) <- TRUE
class(xy)

# runs the kernel density estimation
kde.output <- kernelUD(data.Points2, h="href", grid = xy)

但是,当使用.shp.csv Input File:

In proj4string(xy) :   CRS object has comment, which is lost in output

我通过https://cran.r-project.org/web/packages/sp/vignettes/crs_warnings.html and /spatial_crs_coding/,并进行了一些修改,但警告消息仍保留!

那么,如何摆脱此警告信息?有没有使用错误的命令?

感谢您的帮助。

I'm trying to create kernel density map from point data (available as .shp and .csv) for 5 different species,at global scale. For some individual, there is only one point locality, but for the others there are few to several points. I will use the output map of KDE to identify the hotspots. I'm using adehabitatHR to produce KDE map as below:

library("sp")
library("rgdal")
library("rgeos")
 
# load the data layer
data.Points <- readOGR("D:/FGH/merged","data")

#Defining a CRS with sp cause coordinate reference systems are represented differently when PROJ < 6 and PROJ >= 6.
crs_wgs84 <- CRS(SRS_string = "EPSG:4326") # WGS 84 has EPSG code 4326
class(crs_wgs84)
wkt_wgs84 <- wkt(crs_wgs84)
cat(wkt_wgs84)

#Set the CRS of a Spatial* object in sp
data.Points2 <- data.Points
coordinates(data.Points2) <-  ~ x + y
slot(data.Points2, "proj4string") <- crs_wgs84
    
library(raster)
library(adehabitatHR)
    
# Define the Domain               
x <- seq(-179.8300, 179.2461, by=0.083333333) # resolution is the pixel size you desire
y <- seq(-42, 52, by=0.083333333)
xy <- expand.grid(x=x,y=y)
coordinates(xy) <- ~x+y
gridded(xy) <- TRUE
class(xy)

# runs the kernel density estimation
kde.output <- kernelUD(data.Points2, h="href", grid = xy)

However, I got this error when either using .shp or .csv input file:

In proj4string(xy) :   CRS object has comment, which is lost in output

I went through https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html and https://inbo.github.io/tutorials/tutorials/spatial_crs_coding/, and did some modifies as above but the warning message is remained!

So, how can I get rid of this warning message? Is there any wrong command used?

Thanks for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文