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

Old-style crs message from sf when running getbb #241

Closed
agila5 opened this issue Sep 4, 2021 · 4 comments
Closed

Old-style crs message from sf when running getbb #241

agila5 opened this issue Sep 4, 2021 · 4 comments

Comments

@agila5
Copy link
Contributor

agila5 commented Sep 4, 2021

Hi @mpadge, sorry to bother you. I just wanted to report a slightly problematic interaction between osmdata and sf (from v1.0.2). Reprex:

# packages
remotes::install_github("ropensci/osmdata")
#> Skipping install of 'osmdata' from a github remote, the SHA1 (d2292260) has not changed since last install.
#>   Use `force = TRUE` to force installation
library(osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
test <- getbb("Lecco, Italy", format_out = "sf_polygon")
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()

Created on 2021-09-04 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 4.0.5 (2021-03-31)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language en                          
#>  collate  English_United Kingdom.1252 
#>  ctype    English_United Kingdom.1252 
#>  tz       Europe/Berlin               
#>  date     2021-09-04                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version   date       lib source                           
#>  assertthat    0.2.1     2019-03-21 [1] CRAN (R 4.0.4)                   
#>  backports     1.2.1     2020-12-09 [1] CRAN (R 4.0.3)                   
#>  class         7.3-18    2021-01-24 [2] CRAN (R 4.0.5)                   
#>  classInt      0.4-3     2020-04-07 [1] CRAN (R 4.0.4)                   
#>  cli           3.0.1     2021-07-17 [1] CRAN (R 4.0.5)                   
#>  crayon        1.4.1     2021-02-08 [1] CRAN (R 4.0.4)                   
#>  curl          4.3.2     2021-06-23 [1] CRAN (R 4.0.5)                   
#>  DBI           1.1.1     2021-01-15 [1] CRAN (R 4.0.4)                   
#>  digest        0.6.27    2020-10-24 [1] CRAN (R 4.0.4)                   
#>  dplyr         1.0.7     2021-06-18 [1] CRAN (R 4.0.5)                   
#>  e1071         1.7-8     2021-07-28 [1] CRAN (R 4.0.5)                   
#>  ellipsis      0.3.2     2021-04-29 [1] CRAN (R 4.0.5)                   
#>  evaluate      0.14      2019-05-28 [1] CRAN (R 4.0.4)                   
#>  fansi         0.5.0     2021-05-25 [1] CRAN (R 4.0.5)                   
#>  fs            1.5.0     2020-07-31 [1] CRAN (R 4.0.4)                   
#>  generics      0.1.0     2020-10-31 [1] CRAN (R 4.0.4)                   
#>  glue          1.4.2     2020-08-27 [1] CRAN (R 4.0.4)                   
#>  highr         0.9       2021-04-16 [1] CRAN (R 4.0.5)                   
#>  htmltools     0.5.1.1   2021-01-22 [1] CRAN (R 4.0.4)                   
#>  httr          1.4.2     2020-07-20 [1] CRAN (R 4.0.4)                   
#>  jsonlite      1.7.2     2020-12-09 [1] CRAN (R 4.0.4)                   
#>  KernSmooth    2.23-18   2020-10-29 [2] CRAN (R 4.0.5)                   
#>  knitr         1.33      2021-04-24 [1] CRAN (R 4.0.5)                   
#>  lattice       0.20-41   2020-04-02 [2] CRAN (R 4.0.5)                   
#>  lifecycle     1.0.0     2021-02-15 [1] CRAN (R 4.0.4)                   
#>  lubridate     1.7.10    2021-02-26 [1] CRAN (R 4.0.4)                   
#>  magrittr      2.0.1     2020-11-17 [1] CRAN (R 4.0.4)                   
#>  osmdata     * 0.1.6.005 2021-09-04 [1] Github (ropensci/osmdata@d229226)
#>  pillar        1.6.2     2021-07-29 [1] CRAN (R 4.0.5)                   
#>  pkgconfig     2.0.3     2019-09-22 [1] CRAN (R 4.0.4)                   
#>  proxy         0.4-26    2021-06-07 [1] CRAN (R 4.0.5)                   
#>  purrr         0.3.4     2020-04-17 [1] CRAN (R 4.0.4)                   
#>  R6            2.5.1     2021-08-19 [1] CRAN (R 4.0.5)                   
#>  Rcpp          1.0.7     2021-07-07 [1] CRAN (R 4.0.5)                   
#>  remotes       2.4.0     2021-06-02 [1] CRAN (R 4.0.5)                   
#>  reprex        2.0.1     2021-08-05 [1] CRAN (R 4.0.5)                   
#>  rlang         0.4.11    2021-04-30 [1] CRAN (R 4.0.5)                   
#>  rmarkdown     2.10      2021-08-06 [1] CRAN (R 4.0.5)                   
#>  rstudioapi    0.13      2020-11-12 [1] CRAN (R 4.0.4)                   
#>  rvest         1.0.1     2021-07-26 [1] CRAN (R 4.0.5)                   
#>  sessioninfo   1.1.1     2018-11-05 [1] CRAN (R 4.0.4)                   
#>  sf          * 1.0-3     2021-08-02 [1] Github (r-spatial/sf@7e60ab3)    
#>  sp            1.4-5     2021-01-10 [1] CRAN (R 4.0.5)                   
#>  stringi       1.7.3     2021-07-16 [1] CRAN (R 4.0.5)                   
#>  stringr       1.4.0     2019-02-10 [1] CRAN (R 4.0.4)                   
#>  styler        1.5.1     2021-07-13 [1] CRAN (R 4.0.5)                   
#>  tibble        3.1.4     2021-08-25 [1] CRAN (R 4.0.5)                   
#>  tidyselect    1.1.1     2021-04-30 [1] CRAN (R 4.0.5)                   
#>  units         0.7-2     2021-06-08 [1] CRAN (R 4.0.5)                   
#>  utf8          1.2.2     2021-07-24 [1] CRAN (R 4.0.5)                   
#>  vctrs         0.3.8     2021-04-29 [1] CRAN (R 4.0.5)                   
#>  withr         2.4.2     2021-04-18 [1] CRAN (R 4.0.5)                   
#>  xfun          0.24      2021-06-15 [1] CRAN (R 4.0.5)                   
#>  xml2          1.3.2     2020-04-23 [1] CRAN (R 4.0.4)                   
#>  yaml          2.2.1     2020-02-01 [1] CRAN (R 4.0.3)                   
#> 
#> [1] C:/Users/Utente/Documents/R/win-library/4.0
#> [2] C:/Program Files/R/R-4.0.5/library

A few notes:

  • same message with sf v1.0.2
  • no messages with sf v1.0.1
  • no message if sf not explicitly loaded (but that's obviously not a solution)

I run some quick debug functions, and I think the problem is the following lines of code:

osmdata/R/getbb.R

Lines 391 to 393 in d229226

crs <- list (epsg = 4326L,
proj4string = "+proj=longlat +datum=WGS84 +no_defs")
class (crs) <- "crs"

(probably the same for multipolygon).

I'm not 100% sure this is really a problem in osmdata, but I thought that maybe you still want to check it. Moreover, according to sf news, that same message will become a warning in the future.

@mpadge
Copy link
Member

mpadge commented Sep 6, 2021

Thanks @agila5, and yes, that is an problem caused by and internal to osmdata. I'll rectify soon.

@mpadge
Copy link
Member

mpadge commented Sep 6, 2021

Previously fixed in #218, but obviously not in all necessary places. Need to link the problem lines identified above to the code used there.

mpadge added a commit that referenced this issue Sep 6, 2021
@mpadge mpadge closed this as completed in f638a31 Sep 6, 2021
@mpadge
Copy link
Member

mpadge commented Sep 6, 2021

Thanks @agila5 !!

library (osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library (sf)
#> Linking to GEOS 3.9.1, GDAL 3.3.1, PROJ 8.0.1
packageVersion ("sf")
#> [1] '1.0.2'
packageVersion ("osmdata")
#> [1] '0.1.6.7'
test <- getbb("Lecco, Italy", format_out = "sf_polygon")
print (test)
#> Simple feature collection with 2 features and 0 fields
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 9.243734 ymin: 45.64938 xmax: 9.541106 ymax: 46.15172
#> Geodetic CRS:  WGS 84
#>                         geometry
#> 1 POLYGON ((9.243734 45.76648...
#> 2 POLYGON ((9.366765 45.87497...

Created on 2021-09-06 by the reprex package (v2.0.0.9000)

@agila5
Copy link
Contributor Author

agila5 commented Sep 6, 2021

Hi @mpadge and thanks for the quick fix 🎉

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

2 participants