Created
June 16, 2023 15:07
-
-
Save aadennis/6b8426c603d9f903b09808308c6d87e4 to your computer and use it in GitHub Desktop.
Read a shape file using st_read
This file contains 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
require("sf") | |
# local variables | |
shapefile_name <- "LSOA_2011_EW_BFC" | |
shape_location <- "C:/mapdata/lsoa/boundaries/demo" | |
columns <- "*" | |
local_tempdir <- "c:/temp" | |
# arrange | |
shapefile <- paste(shape_location, "/", shapefile_name, ".shp", sep = "") | |
sql_query <- paste( | |
"select", columns, "from", shapefile_name | |
) | |
# act | |
map <- st_read(shapefile, query = sql_query) | |
map_rowcount <- nrow(map) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment