session_grid(NULL)
n <- 1e2
x <- runif(n,min=25,max=65)
y <- runif(n,min=55,max=65)
z <- runif(n,min=1,max=10)
da <- data.frame(x=x,y=y,z=z)
if (requireNamespace("sf",quietly=TRUE)) {
obj1 <- sf::st_as_sf(da,coords=c("x","y"),crs=4326)
print(series(obj1))
fname1 <- file.path(tempdir(),"res1.shp")
print(fname1)
spatial_write(obj1,fname1)
res1 <- spatial_read(fname1,engine="sf")
print(series(res1))
}
print(spatial_dir(tempdir()))
Run the code above in your browser using DataLab