Wraps make_layer_map()
and passes layer created with layer_mapbox()
to
basemap and the neatline parameters to layer_neatline()
(using the same
data as the Mapbox background layer). The neatline parameters are only used
if neatline is NULL
.
Usage
make_mapbox_map(
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 = TRUE,
scale = 0.75,
scaling_factor = "1x",
attribution = TRUE,
logo = TRUE,
access_token = NULL,
neatline = NULL,
color = "black",
bgcolor = "white",
linewidth = 0.5,
linetype = "solid",
expand = TRUE,
hide_grid = TRUE,
label_axes = "----",
width = NULL,
height = NULL,
units = NULL,
orientation = NULL,
location = NULL,
...
)
Arguments
- data
A
sf
,sfc
, orbbox
object.- 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
Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; 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 preceded byggplot2::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
. IfFALSE
, 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 specifyattribution = 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()
- linewidth
Line width of panel border, Default: 0.5
- linetype
Line type of panel border, Default: 'solid'
- expand
If
TRUE
, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. IfFALSE
, limits are taken exactly from the data orxlim
/ylim
.- hide_grid
If
TRUE
, hide grid lines. Default:TRUE
- label_axes
A description of which axes to label passed to
ggplot2::coord_sf()
; defaults to '—-' which hides all axes labels.- width, height
Page width and height. Both are required, if asp is
NULL
. Default toNULL
.- units
Units for width and height. Required unless units is included in dims. Passed to
as_unit_type()
to validate.- orientation
Page orientation, Default:
NULL
. Supported options are "portrait", "landscape", or "square". If width and height suggest a portrait orientation when orientation = "landscape", the dimensions are reversed so the page dimensions match the provided orientation.- location
If
location
is provided anddata
isNULL
,location
is used in place ofdata
.- ...
Arguments passed on to
make_layer_map
labs_ext_params
Optional parameters passed to
labs_ext()
.ggsave_params
List of parameters passed to
papersize::ggsave_ext()
.layer
A ggplot2 layer or a list of ggproto objects. If layer is provided, all parameters passed to
layer_location_data()
(including data, location, dist, diag_ratio, unit, asp, crs, and geom) will be ignored. In this case, the function simply stacks the bg_layer, layer, and fg_layer objects then applies the basemap and neatline (using theset_basemap()
andset_neatline()
helper functions.)bg_layer,fg_layer,addon
A ggplot2 layer or a list of ggproto objects (e.g. scales, labels, etc.) to add to the background or foreground of the primary map layer defined by
"geom"
and other parameters. If the geom creates an opaque layer or layer is an opaque layer (e.g. a layer produced bylayer_mapbox()
) that covers the full map extent, the bg_layer will not be visible.save
If
TRUE
, save file with ggsave_ext usingggsave_params
. Defaults toFALSE
.env
Environment for evaluation of
labs_ext()
if labs_ext_params is supplied.call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.