compare {mapgl} | R Documentation |
Create a Compare slider widget
Description
This function creates a comparison view between two Mapbox GL or Maplibre GL maps, allowing users to swipe between the two maps to compare different styles or data layers.
Usage
compare(
map1,
map2,
width = "100%",
height = NULL,
elementId = NULL,
mousemove = FALSE,
orientation = "vertical"
)
Arguments
map1 |
A |
map2 |
A |
width |
Width of the map container. |
height |
Height of the map container. |
elementId |
An optional string specifying the ID of the container for the comparison. If NULL, a unique ID will be generated. |
mousemove |
A logical value indicating whether to enable swiping during cursor movement (rather than only when clicked). |
orientation |
A string specifying the orientation of the swiper, either "horizontal" or "vertical". |
Value
A comparison widget.
Examples
## Not run:
library(mapgl)
library(mapgl)
m1 <- mapboxgl(style = mapbox_style("light"))
m2 <- mapboxgl(style = mapbox_style("dark"))
compare(m1, m2)
## End(Not run)
[Package mapgl version 0.1.4 Index]