You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to import many points as quickly as possible. It was taking longer than expected in sf, so I tried sp and was surprised to find that it was much quicker. I'm not sure if this is issue-appropriate, but perhaps this issue is unique to me? I'm running OS X, sf 0.6.0.
library(sf)
library(sp)
N <- 1000000
df <- data.frame(lng = runif(N, -120, -100),
lat = runif(N, 30, 48))
tic <- Sys.time()
df_sf <- st_as_sf(df, coords = c("lng", "lat"), crs = "+proj=longlat +datum=WGS84")
print(Sys.time() - tic)
# Time difference of 22.33289 secs
tic <- Sys.time()
coordinates(df) <- ~lng+lat
proj4string(df) <- "+proj=longlat +datum=WGS84"
print(Sys.time() - tic)
# Time difference of 0.8412709 secs