options(sp_evolution_status = 2)
library("sp")
prototype <- new("SpatialPolygons")
summary(prototype)
## Error in is.projected(p4str) : sf required for evolution_status==2L
str(prototype@proj4string)
## Formal class 'CRS' [package "sp"] with 1 slot
## ..@ projargs: chr NA
is.projected(CRS())
## Error in is.projected(CRS()) : sf required for evolution_status==2L
This is because the trivial NA check in the current evolution-2 code of sp:::is.projectedCRS()
comes only after leveraging the "heavy" sf::st_is_longlat(obj).
Could the order be changed such that is.projected() for (legacy) Spatial objects with unknown CRS won't need sf?
( This is from experimenting with surveillance, which currently does not need rgdal, but with evolution 2 would unnecessarily load sf just to get a missing value from is.projected() for maps with unknown projection. )
This is because the trivial NA check in the current evolution-2 code of
sp:::is.projectedCRS()
https://github.com/edzer/sp/blob/fcc10c628385aa2cbfffba940a2196708823168b/R/projected.R#L124-L125
comes only after leveraging the "heavy"
sf::st_is_longlat(obj)
. Could the order be changed such thatis.projected()
for (legacy) Spatial objects with unknown CRS won't need sf?( This is from experimenting with surveillance, which currently does not need rgdal, but with evolution 2 would unnecessarily load sf just to get a missing value from
is.projected()
for maps with unknown projection. )