addBuildings | R Documentation |
This function adds 2.5D buildings to a Leaflet map using the OSM Buildings plugin.
addBuildings(
map,
buildingURL = "https://{s}.data.osmbuildings.org/0.2/59fcc2e8/tile/{z}/{x}/{y}.json",
group = NULL,
eachFn = NULL,
clickFn = NULL,
data = NULL
)
map |
A map widget object created from |
buildingURL |
The URL template for the building data. Default is the OSM Buildings tile server: |
group |
The name of the group the buildings will be added to. |
eachFn |
A JavaScript function (using |
clickFn |
A JavaScript function (using |
data |
A GeoJSON object containing Polygon features representing the buildings. The properties of these polygons can include attributes like |
The 'data' parameter allows you to provide custom building data as a GeoJSON object. The following properties can be used within the GeoJSON:
height
minHeight
color/wallColor
material
roofColor
roofMaterial
shape
roofShape
roofHeight
See the OSM Wiki: Simple_3D_Buildings
https://github.com/kekscom/osmbuildings/ for more details on the OSM Buildings plugin and available properties.
Other OSM-Buildings Plugin:
setBuildingData()
,
setBuildingStyle()
,
updateBuildingTime()
library(leaflet)
library(leaflet.extras2)
leaflet() %>%
addProviderTiles("CartoDB") %>%
addBuildings(group = "Buildings") %>%
addLayersControl(overlayGroups = "Buildings") %>%
setView(lng = 13.4, lat = 52.51, zoom = 15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.