From 6d9f0a9b75443aa6abe8d0ed61cbea2fb9acf4d0 Mon Sep 17 00:00:00 2001 From: Sebastian Gatscha Date: Sun, 1 Sep 2024 13:56:38 +0200 Subject: [PATCH] docs, pkdown --- NEWS.md | 1 + R/buildings.R | 9 +++++++++ README.md | 1 + _pkgdown.yml | 3 +++ man/addBuildings.Rd | 10 ++++++++++ 5 files changed, 24 insertions(+) diff --git a/NEWS.md b/NEWS.md index 61a338f9..2e9b5a52 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # leaflet.extras2 (development version) +* Included [OSM Buildings](https://osmbuildings.org/documentation/leaflet/) plugin * Fix for roxygen2 > 7.0.0. #1491 * The opened sidebar tab is returned as Shiny input using the `sidebar_tabs` ID. * allow `...` in `antpathOptions` to be able to set the pane (e.g.: `renderer= JS('L.svg({pane: "my-pane"})')`) diff --git a/R/buildings.R b/R/buildings.R index 133fb0e5..b20fc19c 100644 --- a/R/buildings.R +++ b/R/buildings.R @@ -41,6 +41,15 @@ buildingsDependency <- function() { #' @seealso \url{https://github.com/kekscom/osmbuildings/} for more details on the OSM Buildings plugin and available properties. #' @family OSM-Buildings Plugin #' @export +#' @examples +#' library(leaflet) +#' library(leaflet.extras2) +#' +#' leaflet() %>% +#' addProviderTiles("CartoDB") %>% +#' addBuildings(group = "Buildings") %>% +#' addLayersControl(overlayGroups = "Buildings") %>% +#' setView(lng = 13.4, lat = 52.51, zoom = 15) addBuildings <- function( map, buildingURL = "https://{s}.data.osmbuildings.org/0.2/59fcc2e8/tile/{z}/{x}/{y}.json", diff --git a/README.md b/README.md index 1cba6f58..3cb9772c 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ If you need a plugin that is not already implemented create an [issue](https://g - [Mapkey Icons](https://github.com/mapshakers/leaflet-mapkey-icon) - [Moving Markers](https://github.com/ewoken/Leaflet.MovingMarker) - [OpenWeatherMap](https://github.com/trafficonese/leaflet-openweathermap) +- [OSMBuildings](https://github.com/kekscom/osmbuildings/tree/master) - [Playback](https://github.com/hallahan/LeafletPlayback) - [Reachability](https://github.com/traffordDataLab/leaflet.reachability) - [Sidebar-v2](https://github.com/Turbo87/sidebar-v2) diff --git a/_pkgdown.yml b/_pkgdown.yml index 7a18070c..e691449b 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -64,6 +64,9 @@ reference: contents: - matches("Openweather") - matches("openweather") + - title: OSM Buildings + contents: + - matches("Building") - title: Playback contents: - matches("Playback") diff --git a/man/addBuildings.Rd b/man/addBuildings.Rd index 56770ff7..9027a2cd 100644 --- a/man/addBuildings.Rd +++ b/man/addBuildings.Rd @@ -45,6 +45,16 @@ The `data` parameter allows you to provide custom building data as a GeoJSON obj } See the OSM Wiki: \href{https://wiki.openstreetmap.org/wiki/Simple_3D_Buildings}{Simple_3D_Buildings} } +\examples{ +library(leaflet) +library(leaflet.extras2) + +leaflet() \%>\% + addProviderTiles("CartoDB") \%>\% + addBuildings(group = "Buildings") \%>\% + addLayersControl(overlayGroups = "Buildings") \%>\% + setView(lng = 13.4, lat = 52.51, zoom = 15) +} \seealso{ \url{https://github.com/kekscom/osmbuildings/} for more details on the OSM Buildings plugin and available properties.