diff --git a/R/buildings.R b/R/buildings.R index b20fc19c..3f5f8ad3 100644 --- a/R/buildings.R +++ b/R/buildings.R @@ -70,6 +70,15 @@ addBuildings <- function( #' @param time a timestamp that can be converted to POSIXct #' @family OSM-Buildings Plugin #' @export +#' @examples +#' library(leaflet) +#' library(leaflet.extras2) +#' +#' leaflet() %>% +#' addTiles() %>% +#' addBuildings() %>% +#' updateBuildingTime(as.POSIXct("2024-09-01 19:00:00 CET")) %>% +#' setView(13.40, 52.51836,15) updateBuildingTime <- function(map, time) { invokeMethod(map, NULL, "updateBuildingTime", time) } @@ -80,6 +89,16 @@ updateBuildingTime <- function(map, time) { #' @param style A named list of styles #' @family OSM-Buildings Plugin #' @export +#' @examples +#' library(leaflet) +#' library(leaflet.extras2) +#' +#' style <- list(color = "#0000ff", wallColor = "gray", roofColor = "orange", shadows = TRUE) +#' leaflet() %>% +#' addTiles() %>% +#' addBuildings() %>% +#' setBuildingStyle(style) %>% +#' setView(13.40, 52.51836,15) setBuildingStyle <- function(map, style = list(color = "#ffcc00", wallColor = "#ffcc00", roofColor = "orange", diff --git a/inst/examples/leafletsync/sync_basic.R b/inst/examples/leafletsync/sync_basic.R index a0cb8cf3..ffd9ec64 100644 --- a/inst/examples/leafletsync/sync_basic.R +++ b/inst/examples/leafletsync/sync_basic.R @@ -37,7 +37,7 @@ server <- function(input, output, session) { }) output$map2 <- renderLeaflet({ leaflet() %>% - addProviderTiles(provider = "Stamen") %>% + addProviderTiles(provider = "CartoDB") %>% addCircleMarkers(data = df, color = "orange") }) output$map3 <- renderLeaflet({ diff --git a/man/setBuildingStyle.Rd b/man/setBuildingStyle.Rd index 4e10a510..713c498f 100644 --- a/man/setBuildingStyle.Rd +++ b/man/setBuildingStyle.Rd @@ -18,6 +18,17 @@ setBuildingStyle( \description{ Update the OSM-Buildings Style } +\examples{ +library(leaflet) +library(leaflet.extras2) + +style <- list(color = "#0000ff", wallColor = "gray", roofColor = "orange", shadows = TRUE) +leaflet() \%>\% + addTiles() \%>\% + addBuildings() \%>\% + setBuildingStyle(style) \%>\% + setView(13.40, 52.51836,15) +} \seealso{ Other OSM-Buildings Plugin: \code{\link{addBuildings}()}, diff --git a/man/updateBuildingTime.Rd b/man/updateBuildingTime.Rd index f5770b5f..7838c312 100644 --- a/man/updateBuildingTime.Rd +++ b/man/updateBuildingTime.Rd @@ -14,6 +14,16 @@ updateBuildingTime(map, time) \description{ Update the Shadows OSM-Buildings with a POSIXct timestamp } +\examples{ +library(leaflet) +library(leaflet.extras2) + +leaflet() \%>\% + addTiles() \%>\% + addBuildings() \%>\% + updateBuildingTime(as.POSIXct("2024-09-01 19:00:00 CET")) \%>\% + setView(13.40, 52.51836,15) +} \seealso{ Other OSM-Buildings Plugin: \code{\link{addBuildings}()},