I was using the sf package for setting or changing the CRS (R version 4.2). For some other project, I had to update to the new version of the R (v4.3).
However, now I need to change the CRS of an object and I receive the following error:
In CPL_crs_from_input(x) :
GDAL Error 1: PROJ: proj_create_from_database: Cannot find proj.db
I made a clean install and re-installed my previous packages (sf, raster, sp, and dependencies) I tried to set proj.db environment
Sys.setenv(PROJ_LIB = "...\\AppData\\Local\\R\\win-library\\4.3\\sf\\proj")
I also tried going back to v4.2 But still, I am getting the same error. I am using the most basic commands and it is not working.
df <- CRS(SRS_string = "EPSG:4326")
df <- st_crs(4326)
Does anyone have any idea of how to fix this?
Update: I tried it on another PC and it is working. So, the R version or packages are not an issue here. I need an idea to solve this or remove directories causing this problem without formatting the PC.
Should never cross-post (https://github.com/r-spatial/sf/issues/2302). Probably a duplicate of https://github.com/r-spatial/sf/issues/2298 on the failing PC. If so, use Sys.setenv("PROJ_LIB"="")
before loading sf
, as in https://github.com/r-spatial/sf/issues/2298#issuecomment-1864805440. To update sf
to a patched version see https://github.com/r-spatial/sf/issues/2298#issuecomment-1867563910.