Spaces:
Running
Running
feat: Set initial map zoom to 5 and update 'zoom home' to fly to a fixed national view.
Browse files
server.R
CHANGED
|
@@ -310,22 +310,15 @@ server <- function(input, output, session) {
|
|
| 310 |
maplibre(
|
| 311 |
style = ofm_positron_style,
|
| 312 |
center = c(19.1451, 51.9194),
|
| 313 |
-
zoom =
|
| 314 |
) %>%
|
| 315 |
add_navigation_control(show_compass = FALSE, visualize_pitch = FALSE, position = "top-left")
|
| 316 |
})
|
| 317 |
|
| 318 |
# Zoom to extent of all stations (home button)
|
| 319 |
observeEvent(input$zoom_home, {
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
if (nrow(st) > 0) {
|
| 323 |
-
lons <- range(st$lon, na.rm = TRUE)
|
| 324 |
-
lats <- range(st$lat, na.rm = TRUE)
|
| 325 |
-
|
| 326 |
-
maplibre_proxy("map") %>%
|
| 327 |
-
fit_bounds(c(lons[1], lats[1], lons[2], lats[2]), animate = TRUE)
|
| 328 |
-
}
|
| 329 |
})
|
| 330 |
|
| 331 |
# --- Basemap Switching Logic ---
|
|
|
|
| 310 |
maplibre(
|
| 311 |
style = ofm_positron_style,
|
| 312 |
center = c(19.1451, 51.9194),
|
| 313 |
+
zoom = 5
|
| 314 |
) %>%
|
| 315 |
add_navigation_control(show_compass = FALSE, visualize_pitch = FALSE, position = "top-left")
|
| 316 |
})
|
| 317 |
|
| 318 |
# Zoom to extent of all stations (home button)
|
| 319 |
observeEvent(input$zoom_home, {
|
| 320 |
+
maplibre_proxy("map") %>%
|
| 321 |
+
fly_to(center = c(19.1451, 51.9194), zoom = 5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
})
|
| 323 |
|
| 324 |
# --- Basemap Switching Logic ---
|