Closed
Description
Current Behavior
When converting an sf
object to a Spatial
object I'm getting a strange error that I don't know how to deal with (see below).
nys <- st_read("~/Documents/CAFRI/data/maps/nys/NYS_Civil_Boundaries_SHP/State_Shoreline.shp")
#> Reading layer `State_Shoreline' from data source `/Users/lucasj/Documents/CAFRI/data/maps/nys/NYS_Civil_Boundaries_SHP/State_Shoreline.shp' using driver `ESRI Shapefile'
#> Simple feature collection with 1 feature and 6 fields
#> geometry type: MULTIPOLYGON
#> dimension: XY
#> bbox: xmin: 105571.4 ymin: 4483090 xmax: 764142.8 ymax: 4985444
#> projected CRS: NAD83 / UTM zone 18N
sf::as_Spatial(nys)
#> Error in h(simpleError(msg, call)) :
#> error in evaluating the argument 'x' in selecting a method for function 'addAttrToGeom': no arguments in initialization list
packageVersion("sf")
#> [1] ‘0.9.6’
packageVersion("sp")
#> [1] ‘1.4.4’
sessionInfo()
#> R version 4.0.1 (2020-06-06)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.6
#> Matrix products: default
#> BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#> other attached packages:
#> [1] sf_0.9-6
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.5.2 rstudioapi_0.11 magrittr_1.5 units_0.6-7 tidyselect_1.1.0 lattice_0.20-41 R6_2.4.1 rlang_0.4.6 dplyr_1.0.0 tools_4.0.1
#>[11] rgdal_1.5-10 grid_4.0.1 packrat_0.5.0 KernSmooth_2.23-17 e1071_1.7-3 DBI_1.1.0 ellipsis_0.3.1 class_7.3-17 tibble_3.0.1 lifecycle_0.2.0
#>[21] crayon_1.3.4 purrr_0.3.4 vctrs_0.3.1 glue_1.4.1 sp_1.4-4 compiler_4.0.1 pillar_1.4.4 generics_0.0.2 classInt_0.4-3 pkgconfig_2.0.3
sf::sf_extSoftVersion()
#> GEOS GDAL proj.4 GDAL_with_GEOS USE_PROJ_H
#> "3.8.1" "3.1.1" "6.3.1" "true" "true"
rgdal::rgdal_extSoftVersion()
#> GDAL GDAL_with_GEOS PROJ sp
#> "2.4.2" "FALSE" "5.2.0" "1.4-2"
Desired Behavior
It would be nice to have a more informative error message so I can diagnose the issue. Or perhaps this is a bug and it should be fixed.