简体   繁体   English

Rdgal 不能很好地保存 shapefile

[英]Rdgal don't working well to save a shapefile

I'm trying to save a shapefile format with detection rates using the "rgdal" packages, but the following error occurs:我正在尝试使用“rgdal”包保存具有检测率的 shapefile 格式,但出现以下错误:

Error in showSRID(uprojargs, format = "PROJ", multiline = "NO") : 
  Can't parse PROJ.4-style parameter string
+proj=longlat +ellps=WGS84+datum=WGS84+no_def

How to fix?怎么修?

Reproductive example生殖例子

library(rgdal)
library(sp)
library(camtrapR)

Long<-c(-53.59390711, -53.58148303)
Lat<-c(-4.633924739, -4.6340598)
df1<-data.frame(Long,Lat)
df1$Station<-NA
df1[df1$Long=="-53.59390711",]$Station<-"w"
df1[df1$Long=="-53.58148303",]$Station<-"z"

Station<-c("w","w","w","w","w","w","w","w","w","w","z","z","z","z","z","z","z","z","z","z")
Species<-c("a","a","a","b","b","b","c","c","c","c","a","b","b","b","b","b","c","c","c","c")
df2<-data.frame(Station, Species)


detectionMaps(CTtable=df1,recordTable=df2,Xcol="Long",Ycol="Lat",stationCol="Station",speciesCol="Species",speciesToShow="a",richnessPlot=FALSE,speciesPlots=FALSE,
writeShapefile=TRUE,shapefileDirectory=tempdir(),shapefileName="sp_a", shapefileProjection="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_def")

#The shapefile should be created in this directory: C:\Users\...\AppData\Local\Temp\
          

This is an issue connected to the change from PROJ4 to PROJ6 in rgdal/sp.这是与 rgdal/sp 中从 PROJ4 更改为 PROJ6 相关的问题。 For you the issue is a bit deeper because the camtrapR package is not yet updated to deal with PROJ6.You can read more about the transition to PROJ6 here .对您来说,这个问题有点深,因为camtrapR package 尚未更新以处理 PROJ6。您可以在此处阅读有关过渡到 PROJ6 的更多信息。

Without going too deep into it the solution for you would be to downgrade to an older version of sp and rgdal .无需深入研究,您的解决方案就是降级到旧版本的sprgdal

For sp (< 1.4-2) and rgdal (< 1.5-8).对于 sp (< 1.4-2) 和 rgdal (< 1.5-8)。

EDIT: Since you can define the PROJ String yourself you can also first try: "+init=epsg:4326".编辑:由于您可以自己定义 PROJ 字符串,您也可以先尝试:“+init=epsg:4326”。 This might still work.这可能仍然有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM