Adds points, lines, and polygons organized by floor to a leaflet::leaflet()
map. Exactly one floor is visible for each dataset_id.
Usage
addIndoor(
map,
data = leaflet::getMapData(map),
level = "level",
dataset_id = "indoor",
level_order = NULL,
initial_level = NULL,
layerId = NULL,
label = NULL,
popup = NULL,
style = NULL,
options = indoorOptions(),
labelOptions = leaflet::labelOptions(),
popupOptions = leaflet::popupOptions(),
missing_level = c("error", "drop"),
crs = c("auto", "geographic", "simple"),
photos = NULL,
photoOptions = indoorPhotoOptions(),
comments = NULL,
commentOptions = indoorCommentOptions()
)Arguments
- map
A Leaflet map or proxy.
- data
An
sf,sfc, optionalSpatVector, or GeoJSON object. The default uses the data supplied toleaflet::leaflet()orleaflet::leafletProxy().- level
For
sfand GeoJSON, the floor column or property name. For a baresfc, an explicit vector or list of floor values.- dataset_id
Non-empty identifier scoped to this map.
- level_order
Optional vector containing every observed floor exactly once, from lowest to highest.
- initial_level
Initial floor. The default is
"0"when present, then the first floor inlevel_order.- layerId
Optional feature identifiers. Formulas are evaluated against
data.- label, popup
Optional tooltip and popup content. Plain strings are escaped; wrap trusted markup in
htmltools::HTML().- style
Optional named list of fixed, vector, or formula-driven Leaflet path options.
- options
Options created by
indoorOptions().- labelOptions, popupOptions
Leaflet tooltip and popup options.
- missing_level
Either
"error"or"drop".- crs
Coordinate interpretation.
"auto"detects the map CRS for ordinary maps. Use"simple"explicitly for local coordinates sent to a proxy.- photos
Optional photo catalogue created by
indoorPhotoCatalog(), or a data frame with equivalentlayerId,src,caption, and optionalaltcolumns. Catalogue identifiers must matchlayerIdvalues.- photoOptions
Carousel labels created by
indoorPhotoOptions().- comments
Optional catalogue created by
indoorCommentCatalog(), or a data frame with equivalent columns. Identifiers must matchlayerId.- commentOptions
Icon and labels created by
indoorCommentOptions().
Examples
leaflet::leaflet(
indoor_demo,
options = leaflet::leafletOptions(
crs = leaflet::leafletCRS("L.CRS.Simple")
)
) |>
leaflet::addMapPane("indoor", 420) |>
addIndoor(
initial_level = "0",
layerId = ~feature_id,
label = ~name,
popup = ~description,
crs = "simple",
options = indoorOptions(pane = "indoor")
) |>
addIndoorControl(position = "bottomright")