Closed fipoucat closed 4 months ago
What operating system and what returns gdal(lib="")
? Maybe if you set the path to the PROJ library Sys.setenv(PROJ_LIB="")
, it will work?
I am using window 11, below the output from the command:
gdal(lib="") gdal proj geos "3.8.2" "9.3.1" "3.11.2"
If you installed the binary version of {terra}, I think PROJ should work out of the box. Maybe provide small reprex, then I will try to test it.
I'm running into this issue with the development version as well. Here's a short reproducible example.
library(terra)
#> Warning: package 'terra' was built under R version 4.3.3
#> terra 1.7.79
r<- rast(volcano,
extent= ext(2667400, 2667400 + ncol(volcano)*10,
6478700, 6478700 + nrow(volcano)*10),
crs = "EPSG:27200")
#> Warning: PROJ: proj_create_from_database: Cannot find proj.db (GDAL error 1)
#> Error: [rast] empty srs
r
#> Error in eval(expr, envir, enclos): object 'r' not found
Created on 2024-06-07 with reprex v2.0.2
Under the CRAN version, I get
library(terra)
#> Warning: package 'terra' was built under R version 4.3.3
#> terra 1.7.78
r<- rast(volcano,
extent= ext(2667400, 2667400 + ncol(volcano)*10,
6478700, 6478700 + nrow(volcano)*10),
crs = "EPSG:27200")
r
#> class : SpatRaster
#> dimensions : 87, 61, 1 (nrow, ncol, nlyr)
#> resolution : 10, 10 (x, y)
#> extent : 2667400, 2668010, 6478700, 6479570 (xmin, xmax, ymin, ymax)
#> coord. ref. : NZGD49 / New Zealand Map Grid (EPSG:27200)
#> source(s) : memory
#> name : lyr.1
#> min value : 94
#> max value : 195
Created on 2024-06-07 with reprex v2.0.2
An even smaller example is this
library(terra)
#> Warning: package 'terra' was built under R version 4.3.3
#> terra 1.7.79
crs("EPSG:4326")
#> Warning: PROJ: proj_create_from_database: Cannot find proj.db (GDAL error 1)
#> Error: [rast] empty srs
Created on 2024-06-07 with reprex v2.0.2
library(terra)
#> Warning: package 'terra' was built under R version 4.3.3
#> terra 1.7.78
crs("EPSG:4326")
#> [1] "GEOGCRS[\"WGS 84\",\n ENSEMBLE[\"World Geodetic System 1984 ensemble\",\n MEMBER[\"World Geodetic System 1984 (Transit)\"],\n MEMBER[\"World Geodetic System 1984 (G730)\"],\n MEMBER[\"World Geodetic System 1984 (G873)\"],\n MEMBER[\"World Geodetic System 1984 (G1150)\"],\n MEMBER[\"World Geodetic System 1984 (G1674)\"],\n MEMBER[\"World Geodetic System 1984 (G1762)\"],\n MEMBER[\"World Geodetic System 1984 (G2139)\"],\n ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n LENGTHUNIT[\"metre\",1]],\n ENSEMBLEACCURACY[2.0]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"geodetic latitude (Lat)\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"geodetic longitude (Lon)\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n USAGE[\n SCOPE[\"Horizontal component of 3D system.\"],\n AREA[\"World.\"],\n BBOX[-90,-180,90,180]],\n ID[\"EPSG\",4326]]"
Created on 2024-06-07 with reprex v2.0.2
I recently noticed similar failures in Windows GitHub action checks that were installing from r-universe. E.g. https://github.com/ncss-tech/soilDB/actions/runs/9325582703/job/25748112730#step:11:190
Seems to work as expected on other platforms, but there is something not quite right with the Windows r-universe PROJ install, I think
Subsequent to above check I removed the action step that installs from r-universe on Windows.
I am using window 11, below the output from the command:
gdal(lib="") gdal proj geos "3.8.2" "9.3.1" "3.11.2"
here is what I am getting using your example:
library(terra) terra 1.7.78 There were 37 warnings (use warnings() to see them) r<- rast(volcano,
- extent= ext(2667400, 2667400 + ncol(volcano)*10,
- 6478700, 6478700 + nrow(volcano)*10),
- crs = "EPSG:27200") Error: [rast] empty srs In addition: Warning message: PROJ: proj_create_from_database: Cannot find proj.db (GDAL error 1)
@fipoucat, if you uninstall terra first and then reinstall from CRAN does it work for you?
No, I removed and installed the cran version but unfortunately still has the same error.
On Sun, Jun 9, 2024 at 4:54 PM Alex @.***> wrote:
@fipoucat https://github.com/fipoucat, if you uninstall terra first and then reinstall from CRAN does it work for you?
— Reply to this email directly, view it on GitHub https://github.com/rspatial/terra/issues/1535#issuecomment-2156697045, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXY6LKPEBQRSJZQSNOP4A3ZGSCEXAVCNFSM6AAAAABI6GFF2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJWGY4TOMBUGU . You are receiving this because you were mentioned.Message ID: @.***>
I think this was related to the development version only, and that this has now been fixed.
what about this, which is strange because I can find on the same path dll related issue:
Can't load requested DLL: C:\Program Files\GDAL\gdalplugins\gdal_KEA.dll 126: specified module not found. (GDAL error 1)
I am assuming you installed "terra" from CRAN with install.packages("terra")
. The error message suggests there is a conflict with another GDAL installation on your computer. That is surprising because R packages on Windows are self-contained and should not use this type of DLL. But I do not have enough information about your system to provide help. Perhaps you can uninstall the other GDAL installation first?
Well, I'll look for something else, not that lucky with this gdal issue because my Windows is a virtual machine on my old Mac. I
good luck.
I am using a package that requires Terra, but I am getting an error that looks related to Terra, and wonder if someone knows a fix for this kind of error.
Caution! if hourly data is provided then it is converted into daily mean. bootstrapping the event 1000 times in the 1951-1980: |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=27s
Error: [project] Cannot do this transformation In addition: Warning messages: 1: PROJ: proj_create: no database context specified (GDAL error 1) 2: PROJ: proj_create: no database context specified (GDAL error 1)