layer_static_mapbox( location = NULL, buffer_dist = 1000, units = "m", style_id, username, style_url = NULL, overlay_sf = NULL, overlay_style = NULL, overlay_markers = NULL, width = NULL, height = NULL, scale = 0.5, scaling_factor = c("1x", "2x"), attribution = TRUE, logo = TRUE, before_layer = NULL, access_token = NULL, ... ) tm_static_mapbox( location = NULL, buffer_dist = 1000, units = "m", style_id, username, style_url = NULL, overlay_sf = NULL, overlay_style = NULL, overlay_markers = NULL, width = NULL, height = NULL, scale = 0.5, scaling_factor = c("1x", "2x"), attribution = TRUE, logo = TRUE, before_layer = NULL, access_token = NULL, ... )
An input location for which you would like to request tiles.
Can be a length-4 vector representing a bounding box, or an
If an input
sf object is supplied, use the
buffer_dist argument to
control how much area you want to capture around the layer.
While the input
sf object can be in an arbitrary coordinate reference system,
if a length-4 bounding box vector is supplied instead it must represent
WGS84 longitude/latitude coordinates and be in the order
c(xmin, ymin, xmax, ymax).
The distance to buffer around an input
sf object for
determining static map, specified in units. If location is a POINT object
of 2 rows or less and
buffer_dist is 0 or
NULL, a 1 unit buffer is
applied to try to ensure the creation of a valid bounding box for the map
buffer_dist; defaults to "m" (meters). If buffer_dist
is a units class object, the units argument is ignored.
A style ID (required if style_url is
A Mapbox username (required if
style_url = NULL).
A Mapbox style url; defaults to
sf object (optional). The function will
sf object to GeoJSON then plot over the basemap style.
Spatial data that are too large will trigger an error, and should be added
to the style in Mapbox Studio instead.
A named list of vectors specifying how to style the sf
overlay. Possible names are "stroke", "stroke-width" (or "stroke_width"),
"stroke-opacity" (or "stroke_opacity"), "fill", and "fill-opacity" (or
"fill_opacity"). The fill and stroke color values can be specified as
six-digit hex codes or color names, and the opacity and width values should
be supplied as floating-point numbers. If overlay_style is
style values can be pulled from columns with the same names in
The prepared overlay markers (optional). See the function prep_overlay_markers for more information on how to specify a marker overlay.
The map width and height; defaults to
ratio to scale the output image;
scale = 1 will return the
largest possible image. defaults to 0.5
The scaling factor of the tiles; either
(the default) or
Controls whether there is attribution on the image.
FALSE, the watermarked attribution is removed from
the image. You still have a legal responsibility to attribute maps that use
OpenStreetMap data, which includes most maps from Mapbox. If you specify
attribution = FALSE, you are legally required to include proper
attribution elsewhere on the webpage or document.
Controls whether there is a Mapbox logo on the image. Defaults to
A character string that specifies where in the hierarchy
of layer elements the overlay should be inserted. The overlay will be
placed just above the specified layer in the given Mapbox styles. List
layer ids for a map style with
get_style(style_id = style_id, username = username, style_url = style_url, access_token = access_token)[["layers"]][["id"]]
A Mapbox access token; which can be set with mb_access_token.
This function uses a different approach
layer_static_mapbox() is based largely on
layer_mapbox() in the snapbox package
(available under a MIT license. There
are a few key differences between
layer_mapbox(). The "scale" parameter is equivalent to the
"scale_ratio" parameter for snapbox. Setting
scale_factor = "2x" is
equivalent to setting
retina = TRUE. Both functions return basemaps that
are no larger than a single tile (a maximum of 1280 by 1280 pixels).