r - Rdgal 不能很好地保存 shapefile
问题描述
我正在尝试使用“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
怎么修?
生殖例子
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\
解决方案
这是与 rgdal/sp 中从 PROJ4 更改为 PROJ6 相关的问题。对您来说,这个问题有点深,因为该camtrapR
软件包尚未更新以处理 PROJ6。您可以在此处阅读有关向 PROJ6 过渡的更多信息。
无需深入研究,您的解决方案就是降级到旧版本的sp
and rgdal
.
对于 sp (< 1.4-2) 和 rgdal (< 1.5-8)。
编辑:由于您可以自己定义 PROJ 字符串,您也可以先尝试:“+init=epsg:4326”。这可能仍然有效。
推荐阅读
- php - 拉拉维尔 5.6。如何使用 html 锚点或其他标签切换语言?
- css - Vuetify - v-btn(按钮)的标签与横向边界重叠
- kentico - 如何找到跨 Kentico 实例使用表单的每个页面?
- java - 工具栏 findViewById 返回空指针
- node.js - 如何终止 npm 查询器提示并将控制权返回到主菜单/功能
- linux - GNU makefile shell 命令无法正常工作
- mysql - 如何检查MySQL中是否存在主键
- python - Python 请求:登录 Microsoft.com 但退出
- python - 如何在python中调用前两周同一天的值
- python - 两个条件循环python