mapboxgl function

Initialize a Mapbox GL Map

Initialize a Mapbox GL Map

mapboxgl( style = NULL, center = c(0, 0), zoom = 0, bearing = 0, pitch = 0, projection = "globe", parallels = NULL, access_token = NULL, bounds = NULL, width = "100%", height = NULL, ... )

Arguments

  • style: The Mapbox style to use.
  • center: A numeric vector of length 2 specifying the initial center of the map.
  • zoom: The initial zoom level of the map.
  • bearing: The initial bearing (rotation) of the map, in degrees.
  • pitch: The initial pitch (tilt) of the map, in degrees.
  • projection: The map projection to use (e.g., "mercator", "globe").
  • parallels: A vector of two numbers representing the standard parellels of the projection. Only available when the projection is "albers" or "lambertConformalConic".
  • access_token: Your Mapbox access token.
  • bounds: An sf object or bounding box to fit the map to.
  • width: The width of the output htmlwidget.
  • height: The height of the output htmlwidget.
  • ...: Additional named parameters to be passed to the Mapbox GL map.

Returns

An HTML widget for a Mapbox map.

Examples

## Not run: mapboxgl(projection = "globe") ## End(Not run)
  • Maintainer: Kyle Walker
  • License: MIT + file LICENSE
  • Last published: 2025-03-18