layer_mapbox: Use mapboxapi to make a Mapbox static map layer

View source: R/layer_mapbox.R

layer_mapboxR Documentation

Use mapboxapi to make a Mapbox static map layer

Description

Use mapboxapi to make a Mapbox static map layer

Usage

layer_mapbox(
  data = NULL,
  dist = NULL,
  diag_ratio = NULL,
  unit = "meter",
  asp = NULL,
  style_url = "mapbox://styles/mapbox/satellite-streets-v11",
  style_id = NULL,
  username = NULL,
  basemap = FALSE,
  scale = 0.75,
  scaling_factor = "1x",
  attribution = TRUE,
  logo = TRUE,
  access_token = NULL,
  neatline = TRUE,
  color = "black",
  bgcolor = "white",
  size = 1,
  linetype = "solid",
  expand = FALSE,
  hide_grid = TRUE,
  label_axes = "----",
  ...
)

Arguments

data

sf, sfc, or bbox object; any objects convertible with as_bbox

dist

buffer distance in units. Optional.

diag_ratio

ratio of diagonal distance of area's bounding box used as buffer distance. e.g. if the diagonal distance is 3000 meters and the "diag_ratio = 0.1" a 300 meter will be used. Ignored when dist is provided.

unit

Buffer units; defaults to meter.

asp

Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3"). If numeric, get_asp() returns the same value without modification.

style_url

Map style url used to fill style_id and username parameters, Default: "mapbox://styles/mapbox/satellite-streets-v11"

style_id

A style ID (required if style_url is NULL).

username

A Mapbox username (required if style_url = NULL).

basemap

If FALSE, create a standalone layer; if TRUE, the layer is precededed by ggplot2::ggplot() to allow use as a basemap, Default: TRUE

scale

ratio to scale the output image; scale = 1 will return the largest possible image. defaults to 0.5

scaling_factor

The scaling factor of the tiles; either "1x" (the default) or "2x"

attribution

Controls whether there is attribution on the image. Defaults to TRUE. If 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.

logo

Controls whether there is a Mapbox logo on the image. Defaults to TRUE.

access_token

A Mapbox access token; which can be set with mb_access_token.

neatline

If TRUE, add a neatline matching the provided data, Default: TRUE

color

Color of panel border, Default: 'black'

bgcolor

Fill color of panel background; defaults to "white". If "none", panel background is set to ggplot2::element_blank()

size

Size of panel border, Default: 1

linetype

Line type of panel border, Default: 'solid'

expand

Default FALSE. If TRUE, the function adds ggplot2::scale_y_continuous() and ggplot2::scale_x_continuous() to expand the map extent to provided parameters.

hide_grid

If TRUE, hide major grid lines. Default: TRUE

label_axes

A description of which axes to label passed to ggplot2::coord_sf(); defaults to '—-' which hides axes labels.

...

Additional parameter passed to mapboxapi::layer_static_mapbox

See Also

mapboxapi::layer_static_mapbox()


elipousson/overedge documentation built on Aug. 13, 2022, 7:41 p.m.