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, orbboxobject.- 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
distis 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 = 1will 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. Giving a logical vector will separately control the expansion for the four directions (top, left, bottom and right). Theexpandargument will be recycled to length 4 if necessary. Alternatively, can be a named logical vector to control a single direction, e.g.expand = c(bottom = FALSE).- 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 or
require_units = FALSE. Passed toas_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
locationis provided anddataisNULL,locationis used in place ofdata.- ...
Arguments passed on to
make_layer_mapimage_pathpath to location of images for
make_image_map()image_geomFor
make_image_map(), geom to use with layer_markers to mark the location of images (based on EXIF metadata).labs_ext_paramsOptional parameters passed to
labs_ext().ggsave_paramsList of parameters passed to
papersize::ggsave_ext().layerA 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,addonA 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.saveIf
TRUE, save file with ggsave_ext usingggsave_params. Defaults toFALSE.envEnvironment for evaluation of
labs_ext()if labs_ext_params is supplied.crsCoordinate reference system of bounding box to return; defaults to
NULLwhich maintains the crs of the input object.geomA character string indicating which ggplot2 geom to use, Default: 'sf'. Options include "sf" (
ggplot2::geom_sf()), "icon" (layer_icon()), "markers" (layer_markers()), "sf_text" (ggplot2::geom_sf_text()), and "sf_label" (ggplot2::geom_sf_label()). See details for a full list.paperPaper matching name from
paper_sizes(e.g. "letter"). Not case sensitive.imageImage name passed to name parameter of
get_social_size().platformSocial media platform, "Instagram", "Facebook", or "Twitter", Default:
NULLformatImage format, "post", "story", or "cover", Default:
NULLnumberIf
TRUE, number markers usinglayer_markers()(not currently supported)num_by_groupIf
TRUE, numbers are added by group based on groupname_col.groupname_colGroup column name, used to join group metadata if group_meta is a non-spatial data frame; Default:
NULLgroup_metaGroup metadata as a data frame or sf object that intersect with markers (using join function); Default:
NULLsortSort column name, Default: "dist_xmin_ymax".
descIf
TRUE, sort descending; defaultFALSE.num_styleStyle of enumeration, either "arabic", "alph", "Alph", "roman", "Roman".
num_startStarting number; defaults to 1.
suffixCharacter to appended to "number" column. (e.g. "." for "1." or ":" for "1:"). Can also be a character vector with the same length as the number column.
callThe 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 thecallargument ofabort()for more information.
