Description Usage Arguments Examples
Usually you will add the popups in the add_layer function by setting the popup
parameter.
1 | add_popups(map, layer_id, popup)
|
map |
A mapboxer object. |
layer_id |
The ID of the layer to which you want to add the popups. |
popup |
A mustache template in which the tags refer to the properties of the layer's data object. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | LAYER_ID <- "crashes"
mustache_tpl <- "
<b>Date:</b> {{date}}</br>
<b>Time:</b> {{time}}</br>
<b>Number of persons injured:</b> {{injured}}
"
map <- motor_vehicle_collisions_nyc %>%
as_mapbox_source() %>%
mapboxer(
center = c(-73.9165, 40.7114),
zoom = 9
) %>%
add_circle_layer(
circle_color = "red",
circle_blur = 1,
filter = list(">", "injured", 0),
id = LAYER_ID
) %>%
add_popups(
LAYER_ID,
popup = mustache_tpl
)
if (interactive()) map
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.