OS: Windows
I am plotting a raster file after changing the CRS of the same with st_transform
. Here, is a warning of GDAL Error 1 being generated.
Later, I changed the CRS of the vector/feature file with the newly transformed raster file.
While I am trying to plot sf data (point) with ggplot on R, it too is bouncing back the same error GDAL Error 1, indicating that I might be having multiple versions of PROJ lib which seems to be making the error. The key thing that I noticed was the error message. It was showing the Postgresql directory while mentioning the error message. The error code is mentioned below:
Error_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.
However, though the raster file was successfully plotted, the final error of node stack overflew (Error: node stack overflow
) was propagated while I was trying to plot the crs_transormed feature classes on the raster.
- PostGIS, R- I have these three applications installed, that use GDAL. I also use QGIS.
- The PROJ package's version which is installed on R is 0.4.0.
- If GDAL failed when it successfully tried to transform the point feature's coordinates from the source raster file, it would provide an error message.
- I was trying to use R to develop on VS Code before this error landed. After I started to use R on VS, R Studio started to have this problem.
- I tried uninstalling and installing the rgdal but that did not help.
Though the raster file's CRS transformation was generating the warning messages of having multiple versions of PROJ, it plotted the raster file but the problem occurred when the feature points were to be plotted on the raster file.
- Is it now needed to do a clean installation of GDAL? If yes, then how about doing it without uninstalling Postgis?
- I already reinstalled R to circumvent the problem but that didn't help.
Any sort of assistance would help.
Complete code:
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))
Additional Information:
- I also checked the GDAL Python version with OSGeoShell:
>>> from osgeo import osr
>>> osr.GetPROJVersionMajor()
9
>>> osr.GetPROJVersionMinor()
1
Questions:
-
The error occurs both on R Studio & VS Code
-
The R Studio's version is 4.3.2
-
When I uninstalled R, I did not remove existing packages after uninstallation. How to remove the previously (old) installed R packages after reinstalling?
(If any key information seems to be amiss, do notify. The same will be added)