mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
update map growth map bounds
This commit is contained in:
+40
-3
@@ -819,8 +819,46 @@ growth_counties <- reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
output$growth_map <- renderLeaflet({
|
output$growth_map <- renderLeaflet({
|
||||||
leaflet() %>%
|
req(growth_counties(), input$growth_trend_map_slider, input$growth_map_metric)
|
||||||
addProviderTiles("Stadia.AlidadeSmooth")
|
|
||||||
|
counties_data <- growth_counties()
|
||||||
|
combined_geom <- st_union(counties_data)
|
||||||
|
growth_bbox <- st_bbox(combined_geom)
|
||||||
|
|
||||||
|
growth_year <- input$growth_trend_map_slider
|
||||||
|
growth_county_year <- counties_data %>%
|
||||||
|
filter(year == growth_year)
|
||||||
|
|
||||||
|
map <- leaflet() %>%
|
||||||
|
addProviderTiles("Stadia.AlidadeSmooth") %>%
|
||||||
|
fitBounds(
|
||||||
|
lng1 = growth_bbox[["xmin"]],
|
||||||
|
lng2 = growth_bbox[["xmax"]],
|
||||||
|
lat1 = growth_bbox[["ymin"]],
|
||||||
|
lat2 = growth_bbox[["ymax"]]
|
||||||
|
)
|
||||||
|
|
||||||
|
if (input$growth_map_metric == "Population") {
|
||||||
|
map <- map %>%
|
||||||
|
addPolygons(
|
||||||
|
data = growth_county_year,
|
||||||
|
fillColor = "red",
|
||||||
|
color = "red",
|
||||||
|
fillOpacity = ~population_opacity,
|
||||||
|
weight = 2
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
map <- map %>%
|
||||||
|
addPolygons(
|
||||||
|
data = growth_county_year,
|
||||||
|
fillColor = "blue",
|
||||||
|
color = "blue",
|
||||||
|
fillOpacity = ~housing_opacity,
|
||||||
|
weight = 2
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
map
|
||||||
})
|
})
|
||||||
|
|
||||||
observe({
|
observe({
|
||||||
@@ -924,7 +962,6 @@ output$test_dy <- renderDygraph({
|
|||||||
#3})
|
#3})
|
||||||
```
|
```
|
||||||
|
|
||||||
### County Data {data-height=450 .no-padding}
|
|
||||||
```{r include=FALSE}
|
```{r include=FALSE}
|
||||||
# Growth - County Table
|
# Growth - County Table
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user