changed political boundary data
added a way to select state in 03_make_figures.R
This commit is contained in:
parent
17205a5c19
commit
755089821c
@ -36,8 +36,9 @@ for (layer in layers){
|
|||||||
}
|
}
|
||||||
|
|
||||||
# load political boundaries
|
# load political boundaries
|
||||||
political <- list(NULL)
|
political <- st_crop(
|
||||||
political_boundaries <- list.files(path = paste0(data_dir, "/political_boundaries"))
|
st_transform(
|
||||||
for (boundary in political_boundaries) {
|
st_read(
|
||||||
political[[boundary]] <- st_read(paste0(data_dir, "/political_boundaries/", boundary))
|
paste0(data_dir, "/political_boundaries/bound_p/boundaries_p_2021_v3.shp")),
|
||||||
}
|
crs=crs),
|
||||||
|
y = extent_bbox)
|
@ -7,8 +7,8 @@ ifelse(!dir.exists(file.path(getwd(), figure_dir)), dir.create(file.path(getwd()
|
|||||||
|
|
||||||
# set colors
|
# set colors
|
||||||
colors <- list(darkblue = "#062e57",
|
colors <- list(darkblue = "#062e57",
|
||||||
lightblue = "#b1dcf3",
|
lightblue = "#b1dcf3",
|
||||||
lightgrey = "#6D6D6D")
|
lightgrey = "#6D6D6D")
|
||||||
|
|
||||||
# set dimensions of figures
|
# set dimensions of figures
|
||||||
width <- 8
|
width <- 8
|
||||||
@ -17,29 +17,40 @@ units <- "in"
|
|||||||
res <- 600
|
res <- 600
|
||||||
margin <- 0
|
margin <- 0
|
||||||
|
|
||||||
|
# set state to highlight
|
||||||
|
state <- c("Wisconsin")
|
||||||
|
|
||||||
# plot map
|
# plot map
|
||||||
plot_map <- function () {
|
plot_map <- function () {
|
||||||
plot(sf::st_geometry(extent_poly),
|
plot(sf::st_geometry(extent_poly),
|
||||||
col = colors$lightgrey,
|
col = colors$lightblue,
|
||||||
border = "black")
|
border = NA)
|
||||||
plot(political$Wisconsin_State_Boundary_24K.geojson,
|
plot(sf::st_geometry(political$geometry),
|
||||||
col = colors$darkblue,
|
col = colors$lightgrey,
|
||||||
border = NA,
|
border = NA,
|
||||||
add = TRUE)
|
add = TRUE)
|
||||||
plot(sf::st_geometry(data$NHDWaterbody),
|
plot(sf::st_geometry(political[political$NAME_En %in% state, ]),
|
||||||
col = colors$lightblue,
|
col = colors$darkblue,
|
||||||
border = NA,
|
border = NA,
|
||||||
add = TRUE)
|
add = TRUE)
|
||||||
plot(sf::st_geometry(data$NHDArea),
|
plot(sf::st_geometry(data$NHDWaterbody),
|
||||||
col = colors$lightblue,
|
col = colors$lightblue,
|
||||||
border = NA,
|
border = NA,
|
||||||
add = TRUE)
|
add = TRUE)
|
||||||
plot(sf::st_geometry(data$NHDFlowline),
|
plot(sf::st_geometry(data$NHDArea),
|
||||||
col = colors$lightblue,
|
col = colors$lightblue,
|
||||||
lwd = data$NHDFlowline$TotDASqKM^0.3204*0.0446,
|
border = NA,
|
||||||
border = NA,
|
add = TRUE)
|
||||||
add = TRUE)
|
plot(sf::st_geometry(data$NHDFlowline),
|
||||||
|
col = colors$lightblue,
|
||||||
|
lwd = data$NHDFlowline$TotDASqKM^0.3204*0.0446,
|
||||||
|
border = NA,
|
||||||
|
add = TRUE)
|
||||||
|
plot(sf::st_geometry(extent_poly),
|
||||||
|
col = NA,
|
||||||
|
border = "black",
|
||||||
|
lwd = 1,
|
||||||
|
add = TRUE)
|
||||||
}
|
}
|
||||||
|
|
||||||
# save figure
|
# save figure
|
||||||
@ -66,10 +77,10 @@ plot(sf::st_geometry(data$NHDFlowline),
|
|||||||
# dev.off()
|
# dev.off()
|
||||||
|
|
||||||
png(filename = paste0(figure_dir, "/map.png"),
|
png(filename = paste0(figure_dir, "/map.png"),
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
units = units,
|
units = units,
|
||||||
res = res)
|
res = res)
|
||||||
par(mai=c(margin, margin, margin, margin))
|
par(mai=c(margin, margin, margin, margin))
|
||||||
par(mar=c(1,1,1,1))
|
par(mar=c(1,1,1,1))
|
||||||
plot_map()
|
plot_map()
|
||||||
|
3
extent_olympic.csv
Normal file
3
extent_olympic.csv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
latitude,longitude
|
||||||
|
48.50775,-124.91972
|
||||||
|
46.88398,-122.07015
|
|
3
extent_wa.csv
Normal file
3
extent_wa.csv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
latitude,longitude
|
||||||
|
49.17657,-125.43151
|
||||||
|
45.23644,-115.81455
|
|
3
extent_wi.csv
Normal file
3
extent_wi.csv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
latitude,longitude
|
||||||
|
47.73208,-93.55154
|
||||||
|
41.49273,-86.64896
|
|
Loading…
x
Reference in New Issue
Block a user