From b3dfa529f28bf10948c2b7dfa429d9e12bcffa54 Mon Sep 17 00:00:00 2001 From: dylanbenzi Date: Sun, 3 Aug 2025 01:33:24 -0400 Subject: [PATCH] add rmw inputs to map for calc --- dashboard.Rmd | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/dashboard.Rmd b/dashboard.Rmd index 96d3c8e..e152d3a 100644 --- a/dashboard.Rmd +++ b/dashboard.Rmd @@ -1163,6 +1163,8 @@ observe({ new_lon <- as.numeric(input$impact_lon) if(new_lat >= -90 & new_lat <= 90 & new_lon >= -180 & new_lon <= 180) { + rmw_meters <- input$impact_rmw_slider * 1852 + leafletProxy("impact_analysis_map") %>% setView(lat = new_lat, lng = new_lon, zoom = 9) %>% clearShapes() %>% @@ -1179,7 +1181,64 @@ observe({ addCircles( lng = new_lon, lat = new_lat, - radius = 18000, + radius = rmw_meters, + weight = 1, + color = "blue", + fillColor = "blue", + fillOpacity = 0.05 + ) + } +}) + +observe({ + req(input$impact_rmw) + + if(as.numeric(input$impact_rmw) > 0) { + updateSliderInput( + session, + "impact_rmw_slider", + value = input$impact_rmw + ) + } +}) + +observe({ + req(input$impact_rmw_slider) + + updateTextInput( + session, + "impact_rmw", + value = input$impact_rmw_slider + ) +}) + +observe({ + req(input$impact_rmw, input$impact_rmw_slider) + + rmw_meters <- input$impact_rmw_slider * 1852 + + new_lon = input$impact_storm_lon + new_lat = input$impact_storm_lat + + req(new_lon, new_lat) + + if(new_lat >= -90 & new_lat <= 90 & new_lon >= -180 & new_lon <= 180) { + leafletProxy("impact_analysis_map") %>% + clearShapes() %>% + clearMarkers() %>% + addCircleMarkers( + lng = new_lon, + lat = new_lat, + radius = 2, + weight = 0, + color = "blue", + fillColor = "blue", + fillOpacity = 0.5 + ) %>% + addCircles( + lng = new_lon, + lat = new_lat, + radius = rmw_meters, weight = 1, color = "blue", fillColor = "blue",