Skip to content

Commit

Permalink
added map
Browse files Browse the repository at this point in the history
  • Loading branch information
fawda123 committed Nov 22, 2023
1 parent 811eb85 commit 777dbd2
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 13 deletions.
6 changes: 4 additions & 2 deletions R/dat_proc.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ pth <- 'https://raw.githubusercontent.com/tbep-tech/TBEP_Habitat_Restoration/mai

rstdatall <- read.csv(pth, stringsAsFactors = F) %>%
select(
Year = Federal_Fiscal_Year,
Year = Federal_Fiscal_Year,,
Lat = Latitude,
Lon = Longitude,
Primary = PrimaryHabitat,
General = GeneralHabitat,
Activity = GeneralActivity,
Expand All @@ -32,6 +34,6 @@ rstdatall <- read.csv(pth, stringsAsFactors = F) %>%
Primary = ifelse(Primary == '', NA, Primary),
Activity = ifelse(Activity == '', NA, Activity)
) %>%
select(Year, Primary, General, Activity, Acres, Miles)
select(Year, Lat, Lon, Primary, General, Activity, Acres, Miles)

save(rstdatall, file = here('data/rstdatall.RData'))
26 changes: 26 additions & 0 deletions R/figs.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ library(plotrix)
library(RColorBrewer)
library(scales)
library(tbeptools)
library(ggspatial)
library(sf)

load(file = here('data/rstdatall.RData'))

Expand Down Expand Up @@ -409,6 +411,30 @@ png(here('docs/figs/barcur.png'), height = 5, width = 8, family = 'serif', units
print(p)
dev.off()

# map -----------------------------------------------------------------------------------------

tomap <- rstdatall %>%
st_as_sf(coords = c('Lon', 'Lat'), crs = 4326) %>%
.[tbshed, ]

m <- ggplot() +
ggspatial::annotation_map_tile(zoom = 9, type = 'cartolight', cachedir = system.file("rosm.cache", package = "ggspatial")) +
annotation_north_arrow(location = 'tl', style = north_arrow_orienteering(fill = c('black', 'black'), text_col = NA)) +
annotation_scale(location = 'br', text_cex = 1.5,) +
geom_sf(data= tbshed, fill = 'grey', color = 'darkgrey', inherit.aes = F, alpha = 0.5, linewidth = 1.5) +
geom_sf(data = tomap, fill = '#00806E', color = 'black', pch = 21, inherit.aes = F, size = 4) +
theme(
panel.grid = element_blank(),
axis.title = element_blank(),
axis.text = element_blank(),
axis.ticks = element_blank(),
panel.background = element_rect(fill = NA, color = 'black')
)

png(here('docs/figs/map.png'), height = 5, width = 8, family = 'serif', units = 'in', res = 500)
print(m)
dev.off()

# HMP report cards ----------------------------------------------------------------------------

# show_hmpreport(acres, subtacres, hmptrgs, typ = "targets", ycollapse = TRUE, text = 3)
Expand Down
Binary file modified data/rstdatall.RData
Binary file not shown.
Binary file added docs/figs/map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 21 additions & 10 deletions docs/summaries.html

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion docs/summaries.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ load(file = here('tabs/pritaball.RData'))
load(file = here('tabs/gentaball.RData'))
load(file = here('tabs/pritabcur.RData'))
load(file = here('tabs/gentabcur.RData'))
cur <- gsub('^.*\\(|\\)</h5>', '', gentabcur$prepend[[1]])
cur <- max(rstdatall$Year)
```

Data are from USEPA Generalized Performance and Results Act, National Estuary Program Online Reporting Tool (GPRA/NEPORT), as reported by the Tampa Bay Estuary Program.
Expand Down Expand Up @@ -116,4 +116,10 @@ knitr::include_graphics(here('docs/figs/barcur.png'))
knitr::include_graphics(here('docs/figs/totalpie.png'))
```

## Map

```{r}
knitr::include_graphics(here('docs/figs/map.png'))
```

:::

0 comments on commit 777dbd2

Please sign in to comment.