Created
April 29, 2020 08:05
-
-
Save rCarto/d84ac851f6e65d0109b8b0f758772a6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
nc = st_read(system.file("shape/nc.shp", package="sf")) | |
nc <- st_transform(nc, 32119) | |
# regular grid 512096 polygons | |
grid <- st_make_grid(x = nc, cellsize = 500) | |
t0 <- Sys.time() | |
plot(st_geometry(nc)) | |
plot(grid, add = TRUE) | |
# end of the second plot | |
t1 <- Sys.time() | |
# actual display in RStudio Plots window | |
t2 <- Sys.time() | |
# t2 - t0 | |
# ~ 58 secs | |
t3 <- Sys.time() | |
png("test.png") | |
plot(st_geometry(nc)) | |
plot(grid, add = TRUE) | |
dev.off() | |
t4 <- Sys.time() | |
# t4 - t3 | |
# ~ 23 secs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment