r-spatial / rgee

Google Earth Engine for R
https://r-spatial.github.io/rgee/
Other
691 stars 148 forks source link

Error with ee_print Function Due to Deprecated spatialreference.org URL in ee_utils_get_crs_web #363

Closed MarShaikh closed 3 months ago

MarShaikh commented 5 months ago

At submit an issue, please attached the following information of your rgee session:


- [x] You can find the credentials file on your system: 
```r
library(rgee)
ee_path <- path.expand("~/.config/earthengine/credentials")
file.exists(ee_path)
library(rgee)

# Initialize the Earth Engine module.
ee_Initialize()

# Print metadata for a DEM dataset.
print(ee$Image('USGS/SRTMGL1_003')$getInfo())

Attach your Python (reticulate) configuration:

library(reticulate)
py_config()

library(reticulate)
> py_config()
python:         /Users/lshms102/.virtualenvs/r-reticulate/bin/python
libpython:      /Users/lshms102/.pyenv/versions/3.10.14/lib/libpython3.10.dylib
pythonhome:     /Users/lshms102/.virtualenvs/r-reticulate:/Users/lshms102/.virtualenvs/r-reticulate
version:        3.10.14 (main, Apr 26 2024, 13:10:55) [Clang 15.0.0 (clang-1500.3.9.4)]
numpy:          /Users/lshms102/.virtualenvs/r-reticulate/lib/python3.10/site-packages/numpy
numpy_version:  1.26.4

Description

On trying print and return metadata about Spatial Earth Engine Objects using ee_print and passing an EarthEngine Object: Image as an argument to the function. I get an error. This error is only caused by certain image collections or rather earth engine objects from these collections, from what I have seen in my code, the error is caused by "MODIS/061/MOD11A1", "MODIS/061/MYD13Q1" but not by "UCSB-CHG/CHIRPS/DAILY".

What I Did

Minimal example to recreate the error

collection <- ee$ImageCollection("MODIS/061/MOD11A1") %>%
    ee$ImageCollection$filterDate("2020-01-01", "2020-12-31") %>% 
    ee$ImageCollection$toBands()

ee_print(collection) # error causing line

On running this code snippet, I get this error -

spatialreference.org is down using web.archive.org ...
Error in file(con, "r") : 
  cannot open the connection to 'https://web.archive.org/web/https://spatialreference.org/ref/sr-org/6974/ogcwkt/'

The issue is that web archive has stopped supporting spatial reference. The new data can be found on this link instead.

ambarja commented 3 months ago

@MarShaikh this problem was solved in pull-resquest #364 Thanks for your contribution.