Skip to content

Commit

Permalink
minor fine-tunings
Browse files Browse the repository at this point in the history
  • Loading branch information
osalamon committed Oct 23, 2024
1 parent 95dc60f commit a3b4d01
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/logic/disease_outbreaks/disease_leaflet_map.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
box::use(
terra[rast, project],
leaflet[tileOptions, leaflet, addTiles, addRasterImage, setView, addLayersControl, layersControlOptions],
leaflet[tileOptions, leaflet, addTiles, addRasterImage, setView, addLayersControl, layersControlOptions, addControl, getMapData, addProviderTiles],
)

#' @export
Expand All @@ -13,7 +13,7 @@ disease_leaflet_map_basic <- function(map_raster,
add_control = TRUE,
main_map_features = TRUE) {
leaflet_map <- leaflet() |>
addTiles() |>
addTiles(group = "Default (OpenStreetMap)") |>
setView(
lng = 12.3601,
lat = 51.3402,
Expand All @@ -27,16 +27,23 @@ disease_leaflet_map_basic <- function(map_raster,
group = "Input layer"
) |>
addLayersControl(
baseGroups = c(
"Default (OpenStreetMap)",
),
overlayGroups = c("Input layer"),
options = layersControlOptions(collapsed = FALSE)
)

return(leaflet_map)
}

# TODO
# leaflet(quakes) %>% addTiles() %>%
# fitBounds(~min(long), ~min(lat), ~max(long), ~max(lat))

#' @export
disease_leaflet_with_output_layer <- function(map_output_id, input_raster, output_raster) {
print(input_raster)


leafletProxy(map_output_id) |> # hint: leafletProxy, removeImage, addRasterLegend, addLegend,
clearImages() |>
Expand Down

0 comments on commit a3b4d01

Please sign in to comment.