added political boundaries
adjusted data dir added steps and example to readme
This commit is contained in:
parent
2ddad90d52
commit
549d67236f
@ -3,7 +3,7 @@ library(nhdplusTools)
|
||||
library(sf)
|
||||
|
||||
# set data dir
|
||||
nhdplusTools_data_dir(dir = "data")
|
||||
nhdplusTools_data_dir(dir = "data/hydrologic")
|
||||
|
||||
# load extent of map
|
||||
extent <- read.csv(file = "extent.csv")
|
||||
|
@ -1,9 +1,16 @@
|
||||
# load libraries
|
||||
library(sf)
|
||||
|
||||
# load and crop data
|
||||
# load and crop hydrologic data
|
||||
data <- list(NULL)
|
||||
sf_use_s2(FALSE)
|
||||
for (layer in layers){
|
||||
data[[layer]] <- st_crop(st_read(paste0(nhdplusTools_data_dir(),"/data.gpkg"), layer = layer), y = extent_bbox)
|
||||
}
|
||||
|
||||
# load political boundaries
|
||||
political <- list(NULL)
|
||||
political_boundaries <- list.files(path = "data/political_boundaries")
|
||||
for (boundary in political_boundaries) {
|
||||
political[[boundary]] <- st_read(paste0("data/political_boundaries/", boundary))
|
||||
}
|
||||
|
@ -42,6 +42,5 @@ plot(sf::st_geometry(data$NHDFlowline),
|
||||
xlim = c(extent$longitude_min, extent$longitude_max),
|
||||
ylim = c(extent$latitude_min, extent$latitude_max),
|
||||
add = TRUE)
|
||||
|
||||
# finish saving figure
|
||||
dev.off()
|
||||
|
@ -1,3 +1,11 @@
|
||||
# pretty_rivers
|
||||
|
||||
Downloads USGS data for a given location and makes a pretty map of the rivers. The width of the rivers is proportional to the area of land that the section of river drains.
|
||||
|
||||
## To run :
|
||||
1. Clone the repository
|
||||
2. Edit the extent of the map you want to produce in `extent.csv`. Include lat/long coordinates of two opposite corners (i.e. top-left and bottom-right).
|
||||
3. Run the scripts. Downloading the data and loading the data will take the longest. The whole of Wisconsin downloads ~12GB of data
|
||||
|
||||
## Example figure
|
||||

|
||||
|
Loading…
x
Reference in New Issue
Block a user