Skip to content
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

annotation_map_tile - Error in sp::CRS(paste0("+init=epsg:", epsg)) : NA #84

Open
ckluss opened this issue May 10, 2021 · 5 comments
Open

Comments

@ckluss
Copy link

ckluss commented May 10, 2021

Hi all,

when I try to use annotation_map_tile I get the error Error in sp::CRS(paste0("+init=epsg:", epsg)) : NA. Do you have an idea what the problem could be?

Thx
Christof

> library(ggplot2)
> library(ggspatial)
> load_longlake_data()
> 
> ggplot() +
+   annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) +
+   geom_sf(data = longlake_waterdf, fill = NA, col = "grey50")
Zoom: 13
Error in sp::CRS(paste0("+init=epsg:", epsg)) : NA
> 
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggspatial_1.1.5.9000 ggplot2_3.3.3       

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6         lattice_0.20-44    FNN_1.1.3          class_7.3-19       zoo_1.8-9          gtools_3.8.2       assertthat_0.2.1  
 [8] gstat_2.0-7        digest_0.6.27      utf8_1.2.1         mime_0.10          R6_2.5.0           plyr_1.8.6         e1071_1.7-6       
[15] httr_1.4.2         pillar_1.6.0       rlang_0.4.11       Rmisc_1.5          gdata_2.18.0       geosphere_1.5-10   raster_3.4-10     
[22] hydroGOF_0.4-0     rgdal_1.5-23       foreign_0.8-81     automap_1.0-14     munsell_0.5.0      rosm_0.2.5         proxy_0.4-25      
[29] shiny_1.6.0        compiler_4.0.5     httpuv_1.6.0       xfun_0.22          pkgconfig_2.0.3    hydroTSM_0.6-0     prettymapr_0.2.2  
[36] htmltools_0.5.1.1  mapedit_0.6.0      tidyselect_1.1.1   tibble_3.1.1       intervals_0.15.2   codetools_0.2-18   reshape_0.8.8     
[43] fansi_0.4.2        spacetime_1.2-4    withr_2.4.2        crayon_1.4.1       dplyr_1.0.6        later_1.2.0        sf_0.9-8          
[50] grid_4.0.5         gtable_0.3.0       xtable_1.8-4       lifecycle_1.0.0    DBI_1.1.1          magrittr_2.0.1     units_0.7-1       
[57] scales_1.1.1       KernSmooth_2.23-20 promises_1.2.0.1   sp_1.4-5           xml2_1.3.2         ellipsis_0.3.2     xts_0.12.1        
[64] generics_0.1.0     vctrs_0.3.8        tools_4.0.5        glue_1.4.2         purrr_0.3.4        fastmap_1.1.0      yaml_2.2.1        
[71] colorspace_2.0-1   maptools_1.1-1     classInt_0.4-3     knitr_1.33
@paleolimbot
Copy link
Owner

Thank you for reporting this! I think I know where this error is coming from...I will try to track it down over the weekend!

Out of curiosity, could you tell me what the output of library(sf) looks like in a fresh session? (I'm looking for your PROJ, GEOS, and GDAL versions)

@ckluss
Copy link
Author

ckluss commented May 15, 2021

Thank you very much, it is

Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1

Kind regards
Christof

@tmcd82070
Copy link

Has this issue been resolved. I am getting the same error.

> 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
Error in sp::CRS(paste0("+init=epsg:", epsg)) : NA
> library(sf)
Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE

@ckluss
Copy link
Author

ckluss commented Mar 18, 2022

reinstallation of rdgal with install.packages("rgdal", repos="http://R-Forge.R-project.org") and setting rgdal::set_proj_search_paths("C:/Users/Christof/Documents/R/win-library/4.1/rgdal/proj") as described here jhollist/elevatr#48 (comment) had fixed problem. with rgdal::get_proj_search_paths() you'll see the current path.

@idshklein
Copy link

I have the same problem, updated all relevant packages and changed the search path, and it still produces the same error

> df1 %>% 
+   st_as_sf(coords = c("gtfs_stop__lon","gtfs_stop__lat"),crs = 4326) %>% 
+   ggplot(aes(color = order)) + 
+   annotation_map_tile(zoom = 14)+
+   geom_sf(size = 3)
Error in sp::CRS(paste0("+init=epsg:", intx)) : NA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants