powered by
This function adds a custom control to a Mapbox GL or MapLibre GL map. It allows you to create custom HTML element controls and add them to the map.
add_control(map, html, position = "top-right", className = NULL, ...)
The modified map object with the custom control added.
A map object created by the mapboxgl or maplibre functions.
mapboxgl
maplibre
Character string containing the HTML content for the control.
The position of the control. Can be one of "top-left", "top-right", "bottom-left", or "bottom-right". Default is "top-right".
Optional CSS class name for the control container.
Additional arguments passed to the JavaScript side.
if (FALSE) { library(mapgl) maplibre() |> add_control( html = " Custom HTML ", position = "top-left" ) }
Run the code above in your browser using DataLab