EmilyMarkowitz-NOAA / survey-live-temperature-shiny

These scripts create daily survey station daily temperature and anomaly plots as the ships work their way through the survey.
https://www.fisheries.noaa.gov/alaska/science-data/near-real-time-temperatures-bering-sea-bottom-trawl-survey
MIT License
1 stars 0 forks source link

reactive, observe, observeEvent #16

Closed MichaelSchram-NOAA-Affiliate closed 4 months ago

MichaelSchram-NOAA-Affiliate commented 4 months ago

Need to figure out how to update s_survemap.R to rely on reactive, observe, and observeEvent as opposed to if() statements where possible.

Should be able to render a base map, and then update from there using reactive and observe. That will substantially speed things up and prevent the map from constantly re-rendering everything each time. It's also where Shiny shines in terms of operation.

This post provides a nice overview of the three. https://stackoverflow.com/questions/53016404/advantages-of-reactive-vs-observe-vs-observeevent

Currently, there is a toggle for including temperature data wrapped into the renderLeaflet() call. That should be moved outside of the call such that the map is rendered and then updates are map pending user-defined choices.