警告:GDAL 错误“1”和错误:节点堆栈溢出

问题描述 投票:0回答:1

操作系统:Windows

我正在使用

st_transform
更改相同的 CRS 后绘制光栅文件。这里是生成 GDAL 错误 1 的警告。 后来,我用新转换的光栅文件更改了矢量/特征文件的CRS。 当我尝试在 R 上使用 ggplot 绘制 sf 数据(点)时,它也会反弹相同的错误 GDAL 错误 1,表明我可能拥有多个版本的 PROJ lib,这似乎正在使错误。我注意到的关键是错误消息。它在提到错误消息时显示了 Postgresql 目录。错误代码如下: 错误_1:
GDAL Error 1: PROJ: proj_identify: C:\Program Files\PostgreSQL\13\share\contrib\postgis-3.2\proj\proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation.

但是,虽然栅格文件已成功绘制,但当我尝试在栅格上绘制 crs_transormed 要素类时,传播了节点堆栈溢出

(Error: node stack overflow
) 的最终错误。

  • PostGIS、R - 我安装了这三个使用 GDAL 的应用程序。我也用QGIS。
  • R 上安装的 PROJ 包的版本是 0.4.0
  • 如果 GDAL 在成功尝试转换源栅格文件中的点要素坐标时失败,它将提供错误消息。
  • 在出现此错误之前,我正在尝试使用 R 在 VS Code 上进行开发。当我开始在VS上使用R后,R Studio开始出现这个问题。
  • 我尝试卸载并安装 rgdal,但这没有帮助。

虽然栅格文件的CRS转换生成了具有多个版本的PROJ的警告消息,但它绘制了栅格文件,但是当在栅格文件上绘制特征点时出现了问题。

  1. 现在需要全新安装 GDAL 吗?如果是,那么卸载 Postgis 怎么样?
  2. 我已经重新安装了 R 以规避该问题,但这没有帮助。

任何形式的帮助都会有所帮助。

完整代码:

library(sf)
library(stars)
library(ggplot2)

options(expressions = 500000)

dsm_Hrvd <- read_stars("data/dd/ddd/dddd.tif")
dsm_Hrvd
harv_plot <- st_read("data//dd/ddd/dddd.shp")
harv_plot

st_crs(dsm_Hrvd)
st_crs(harv_plot)

target_crs <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
dsm_Hrvd_rprj <- st_transform(dsm_Hrvd, crs = target_crs)
# or dsm_Hrvd_rprj <- st_transform(dsm_Hrvd, 4326) in case the crs in't recognized
harv_plot_rprj <- st_transform(harv_plot, st_crs(dsm_Hrvd_rprj))

# warnings()

ggplot() +
  geom_stars(data = dsm_Hrvd) +
  # scale_fill_viridis_c() +
  geom_sf(data = harv_plot_rprj, mapping = aes(color = plot_type))

附加信息

  1. 我还使用 OSGeoShell 检查了 GDAL Python 版本:
>>> from osgeo import osr
>>> osr.GetPROJVersionMajor()
9
>>> osr.GetPROJVersionMinor()
1
  1. R Studio 和 VS Code 都会出现该错误

  2. 将 R Studio 更新至 build 494,版本 2023.09.1

(如果有任何关键信息有误,请通知我们,我们会补充)

r ggplot2 nodes gdal proj
1个回答
0
投票

我希望我能提供一个解决方案,但我遇到了类似的问题。我刚刚将 R 和 Rtools 更新到当前版本(v4.3.1 和 43)。当尝试加载 shapefile 或指定 CRS 时,我的错误是相同的。几乎在需要使用 GDAL 的 CRS 组件做任何事情时......

shp <- read_sf("./states.shp")
Warning message:
In CPL_read_ogr(dsn, layer, query, as.character(options), quiet,  :
  GDAL Error 1: PROJ: proj_identify: C:\Program Files\PostgreSQL\14\share\contrib\postgis-3.2\proj\proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation.
© www.soinside.com 2019 - 2024. All rights reserved.