The mapgl R package makes the latest versions of Mapbox GL JS and Maplibre GL JS available to R users. The package interface is designed to make the powerful capabilities of both libraries available in R mapping projects, but also feel similar to users coming from other R mapping packages.
A basic map:
library(mapgl)
mapboxgl()
Customizing the style and projection:
mapboxgl(
style = mapbox_style("satellite"),
projection = "winkelTripel"
)
mapboxgl(
center = c(-97.6, 25.4)
) |>
fly_to(
center = c(-96.810481, 32.790869),
zoom = 18.4,
pitch = 75,
bearing = 136.8
)
library(mapgl)
maplibre()
maplibre(
style = maptiler_style("bright"),
center = c(-43.23412, -22.91370),
zoom = 14
) |>
add_fullscreen_control(position = "top-left") |>
add_navigation_control()