modify growth map name and layer rendering

This commit is contained in:
2025-12-26 19:14:13 -05:00
parent 4ca728714a
commit 2fd4cf305b
+12 -8
View File
@@ -852,21 +852,23 @@ output$growth_map <- renderLeaflet({
map <- map %>% map <- map %>%
addPolygons( addPolygons(
data = growth_county_year, data = growth_county_year,
group = "counties",
fillColor = "red", fillColor = "red",
color = "red", color = "red",
fillOpacity = ~population_opacity, fillOpacity = ~population_opacity,
weight = 2, weight = 1,
popup = ~paste(name) popup = ~name
) )
} else { } else {
map <- map %>% map <- map %>%
addPolygons( addPolygons(
data = growth_county_year, data = growth_county_year,
group = "counties",
fillColor = "blue", fillColor = "blue",
color = "blue", color = "blue",
fillOpacity = ~housing_opacity, fillOpacity = ~housing_opacity,
weight = 2, weight = 1,
popup = ~paste(name) popup = ~name
) )
} }
@@ -889,22 +891,24 @@ observe({
if (input$growth_map_metric == "Population") { if (input$growth_map_metric == "Population") {
leafletProxy("growth_map", data = growth_county_year) %>% leafletProxy("growth_map", data = growth_county_year) %>%
clearShapes() %>% clearGroup("counties") %>%
addPolygons( addPolygons(
group = "counties",
fillColor = "red", fillColor = "red",
color = "red", color = "red",
fillOpacity = ~population_opacity, fillOpacity = ~population_opacity,
weight = 2, weight = 1,
popup = ~name popup = ~name
) )
} else { } else {
leafletProxy("growth_map", data = growth_county_year) %>% leafletProxy("growth_map", data = growth_county_year) %>%
clearShapes() %>% clearGroup("counties") %>%
addPolygons( addPolygons(
group = "counties",
fillColor = "blue", fillColor = "blue",
color = "blue", color = "blue",
fillOpacity = ~housing_opacity, fillOpacity = ~housing_opacity,
weight = 2, weight = 1,
popup = ~name popup = ~name
) )
} }