-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDAL Erorr 4: Unable to open EPSG support file gcs.csv. #1211
Comments
On your system, several R packages (rgdal, sf, lwgeom) link to external libraries (GDAL, GEOS and/or PROJ). It sounds like (some of) these libraries were updated after installing the R packages, and at that point you often need to reinstall the R packages involved. Have you tried reinstalling lwgeom? |
Heads-up I just hit this issue after updating GDAL on my system. Details to follow in case it's of use to others... |
Reprex showing my set-up below. Next step: try re-installing the packages as suggested...: library(sf)
#> Linking to GEOS 3.8.0, GDAL 2.4.2, PROJ 5.2.0
#> WARNING: different compile-time and runtime versions for GEOS found:
#> Linked against: 3.8.0-CAPI-1.13.1 compiled against: 3.7.1-CAPI-1.11.1
#> It is probably a good idea to reinstall sf, and maybe rgeos and rgdal too
library(spData)
data("us_states", package = "spData")
north_carolina = read_sf(system.file("shape/nc.shp", package = "sf"))
#> Warning in CPL_read_ogr(dsn, layer, query, as.character(options), quiet, : GDAL
#> Error 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA
#> environment variable to point to the directory containing EPSG csv files.
us_states_2163 = st_transform(us_states, crs = 2163)
#> Warning in CPL_crs_from_epsg(as.integer(x)): GDAL Error 4: Unable to open EPSG
#> support file gcs.csv. Try setting the GDAL_DATA environment variable to point to
#> the directory containing EPSG csv files.
#> OGR: Corrupt data
#> Error in CPL_transform(x, crs$proj4string): OGR error
north_carolina_2163 = st_transform(north_carolina, crs = 2163)
#> Warning in CPL_crs_from_epsg(as.integer(x)): GDAL Error 4: Unable to open EPSG
#> support file gcs.csv. Try setting the GDAL_DATA environment variable to point to
#> the directory containing EPSG csv files.
#> OGR: Corrupt data
#> Error in CPL_transform(x, crs$proj4string): OGR error Created on 2019-12-06 by the reprex package (v0.3.0) Session infodevtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.1 (2019-07-05)
#> os Ubuntu 18.04.3 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language en_GB:en
#> collate en_GB.UTF-8
#> ctype en_GB.UTF-8
#> tz Europe/London
#> date 2019-12-06
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [2] CRAN (R 3.6.0)
#> backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.1)
#> callr 3.3.2 2019-09-22 [1] CRAN (R 3.6.1)
#> class 7.3-15 2019-01-01 [2] standard (@7.3-15)
#> classInt 0.4-3 2019-12-04 [1] Github (r-spatial/classInt@7bc8a82)
#> cli 1.1.0 2019-03-19 [2] CRAN (R 3.5.3)
#> crayon 1.3.4 2017-09-16 [2] standard (@1.3.4)
#> DBI 1.0.0 2018-05-02 [2] CRAN (R 3.5.2)
#> desc 1.2.0 2018-05-01 [2] standard (@1.2.0)
#> devtools 2.2.1 2019-09-24 [1] CRAN (R 3.6.1)
#> digest 0.6.23 2019-11-23 [1] CRAN (R 3.6.1)
#> e1071 1.7-3 2019-11-26 [2] CRAN (R 3.6.1)
#> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1)
#> evaluate 0.14 2019-05-28 [2] CRAN (R 3.6.0)
#> fs 1.3.1 2019-05-06 [2] CRAN (R 3.6.0)
#> glue 1.3.1 2019-03-12 [2] CRAN (R 3.5.3)
#> highr 0.8 2019-03-20 [3] CRAN (R 3.5.3)
#> htmltools 0.4.0 2019-10-04 [3] CRAN (R 3.6.1)
#> KernSmooth 2.23-16 2019-10-15 [4] CRAN (R 3.6.1)
#> knitr 1.26 2019-11-12 [1] CRAN (R 3.6.1)
#> magrittr 1.5 2014-11-22 [2] CRAN (R 3.5.2)
#> memoise 1.1.0 2017-04-21 [3] CRAN (R 3.5.0)
#> pillar 1.4.2 2019-06-29 [2] CRAN (R 3.6.0)
#> pkgbuild 1.0.6 2019-10-09 [2] CRAN (R 3.6.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.1)
#> pkgload 1.0.2 2018-10-29 [3] CRAN (R 3.5.1)
#> prettyunits 1.0.2 2015-07-13 [2] CRAN (R 3.5.3)
#> processx 3.4.1 2019-07-18 [2] CRAN (R 3.6.1)
#> ps 1.3.0 2018-12-21 [2] CRAN (R 3.5.3)
#> R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.1)
#> Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.1)
#> remotes 2.1.0 2019-06-24 [1] CRAN (R 3.6.1)
#> rlang 0.4.2 2019-11-23 [1] CRAN (R 3.6.1)
#> rmarkdown 1.18 2019-11-27 [1] CRAN (R 3.6.1)
#> rprojroot 1.3-2 2018-01-03 [2] CRAN (R 3.5.3)
#> sessioninfo 1.1.1 2018-11-05 [3] CRAN (R 3.5.1)
#> sf * 0.8-0 2019-09-17 [1] CRAN (R 3.6.1)
#> spData * 0.3.2 2019-09-19 [1] CRAN (R 3.6.1)
#> spDataLarge 0.3.1 2019-05-29 [2] Github (nowosad/spDataLarge@012fe53)
#> stringi 1.4.3 2019-03-12 [2] CRAN (R 3.5.3)
#> stringr 1.4.0 2019-02-10 [2] standard (@1.4.0)
#> testthat 2.3.0 2019-11-05 [2] CRAN (R 3.6.1)
#> tibble 2.1.3 2019-06-06 [2] CRAN (R 3.6.0)
#> units 0.6-5 2019-10-08 [1] CRAN (R 3.6.1)
#> usethis 1.5.1 2019-07-04 [1] CRAN (R 3.6.1)
#> withr 2.1.2 2018-03-15 [2] CRAN (R 3.5.3)
#> xfun 0.11 2019-11-12 [1] CRAN (R 3.6.1)
#> yaml 2.2.0 2018-07-25 [3] CRAN (R 3.5.1)
#>
#> [1] /home/robin/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library |
Updating all the relevant packages with: remotes::install_cran("sf", force = TRUE)
remotes::install_cran("rgdal", force = TRUE)
remotes::install_cran("rgeos", force = TRUE)
remotes::install_cran("lwgeom", force = TRUE) |
Good news: after re-installing those packages, it works! Thanks for reporting the issue @erstearns and the quickfire info on how to fix it. library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.2, PROJ 6.2.1
library(spData)
data("us_states", package = "spData")
north_carolina = read_sf(system.file("shape/nc.shp", package = "sf"))
us_states_2163 = st_transform(us_states, crs = 2163)
north_carolina_2163 = st_transform(north_carolina, crs = 2163) Created on 2019-12-06 by the reprex package (v0.3.0) |
@Robinlovelace which OS & version is this? |
Ubuntu, same as @erstearns by the looks of it. Auto update from
|
Thanks; so Ubuntu LTS with PPA ubuntugis-unstable (our recommended r-spatial Ubuntu platform) is now on GDAL 3.0.2 and PROJ 6.2.1. Also relevant for r-spatial/discuss#28 and #1033 |
Woohoo! Thank you @edzer and @Robinlovelace ! My app is alive and well again :) Thank you for your swift problem-solving and help with this! |
I have a Shiny app that sets the crs of sf objects. This has been running fine until I pushed to the shinyio server as well as an AWS Linux server where I encountered the following error:
Warning: Error in CPL_transform: OGR error
. I went into the code to check the error on my local machine, running Ubuntu 18.04.3 (further system details below) and now my Shiny app does not work locally either and I am running into the following error after runningst_transform
on an sf object(state_bounds <- st_transform(state_bounds, crs = 4326)
):Warning in CPL_crs_from_epsg(as.integer(x)) : GDAL Error 4: Unable to open EPSG support file gcs.csv. Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files. OGR: Corrupt data Error in CPL_transform(x, crs$proj4string) : OGR error
I set the GDAL_DATA environment variable and still received the same error.
I then re-installed RGDAL, and sf and ran into this error pertaining to a tmap call in a downloadable report (.Rmd) file:
When I try to check my versions of geospatial libraries, GEOS and GDAL return version info (see below) but PROJ returns the following:
I am truly bamboozled by this sequence of events because I literally changed nothing from yesterday and everything ran great. My questions are:
Thank you in advance for your help.
Geospatial libraries version information:
GDAL version: GDAL 3.0.2, released 2019/10/28
GEOS version: 3.8.0
Session information:
The text was updated successfully, but these errors were encountered: