Error in sp::CRS and ggspatial::annotation_map_tile respectively

485 Views Asked by At

with reprex::reprex() it works perfect (see below), but in Rterm and RStudio console I get errors ... do you have an idea how to solve this? There are some similar questions but I've found no solution so far

rgdal::rgdal_extSoftVersion()
#> Error: no such table: metadata
sp::CRS(SRS_string='EPSG:4326')
#> Error in sp::CRS(SRS_string = "EPSG:4326") : NA
sp::CRS("+init=epsg:4326")
#> Error in sp::CRS("+init=epsg:4326") : NA

ggplot2::ggplot() +
   ggspatial::annotation_map_tile(
     zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) +
   ggplot2::geom_sf(data = longlake_waterdf, fill = NA, col = "grey50")
#> Error in sp::CRS(paste0("+init=epsg:", epsg)) : NA

Thank you very much, Christof

sf::sf_extSoftVersion()
#>           GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H 
#>        "3.9.1"        "3.2.1"        "7.2.1"         "true"         "true" 
#>           PROJ 
#>        "7.2.1"
 
rgdal::rgdal_extSoftVersion()
#>           GDAL GDAL_with_GEOS           PROJ             sp           EPSG 
#>        "3.2.1"         "TRUE"        "7.2.1"        "1.4-5"      "v10.008"

sp::CRS(SRS_string='EPSG:4326')
#> CRS arguments: +proj=longlat +datum=WGS84 +no_defs
sp::CRS("+init=epsg:4326")
#> CRS arguments: +proj=longlat +datum=WGS84 +no_defs
 
wkt <- sf::st_crs(4326)[[2]]
sp::CRS(wkt)
#> CRS arguments: +proj=longlat +datum=WGS84 +no_defs


ggspatial::load_longlake_data()

ggplot2::ggplot() +
  ggspatial::annotation_map_tile(
    zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) +
  ggplot2::geom_sf(data = longlake_waterdf, fill = NA, col = "grey50")
#> Zoom: 13

Created on 2021-10-22 by the reprex package (v2.0.1)

0

There are 0 best solutions below