Skip to contents

Location is used as the data parameter of layer_location_data so this function is primarily appropriate for the layer_mapbox (geom = "mapbox").

Usage

make_location_map(
  location,
  dist = NULL,
  diag_ratio = NULL,
  unit = NULL,
  asp = NULL,
  data = NULL,
  crs = NULL,
  paper = "Letter",
  orientation = NULL,
  geom = "sf",
  basemap = TRUE,
  bg_layer = NULL,
  fg_layer = NULL,
  save = FALSE,
  name = NULL,
  label = NULL,
  prefix = NULL,
  postfix = NULL,
  filename = NULL,
  device = NULL,
  path = NULL,
  dpi = 300,
  ...
)

make_social_map(
  location,
  dist = NULL,
  diag_ratio = NULL,
  unit = NULL,
  asp = NULL,
  crs = 3857,
  image = NULL,
  platform = NULL,
  format = NULL,
  orientation = NULL,
  basemap = TRUE,
  geom = "mapbox",
  save = FALSE,
  name = NULL,
  filename = NULL,
  label = NULL,
  prefix = NULL,
  postfix = NULL,
  path = NULL,
  filetype = "jpeg",
  dpi = 72,
  ...
)

make_image_map(
  image_path,
  location = NULL,
  dist = NULL,
  diag_ratio = NULL,
  unit = NULL,
  asp = NULL,
  data = NULL,
  crs = 3857,
  paper = "Letter",
  orientation = NULL,
  geom = "mapbox",
  style_url = NULL,
  basemap = TRUE,
  bg_layer = NULL,
  fg_layer = NULL,
  save = FALSE,
  name = NULL,
  label = NULL,
  prefix = NULL,
  postfix = NULL,
  filename = NULL,
  device = NULL,
  path = NULL,
  dpi = 300,
  image_geom = "label",
  groupname_col = NULL,
  group_meta = NULL,
  number = FALSE,
  num_by_group = FALSE,
  num_style = NULL,
  num_start = 1,
  suffix = NULL,
  sort = "dist_xmin_ymax",
  desc = FALSE,
  ...
)

Arguments

location

sf object. If multiple areas are provided, they are unioned into a single sf object using sf::st_union

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.

data

Character string (e.g. url, file path, or name of data from package), a sf, sfc, or bbox object including data in area.

crs

Coordinate reference system of bounding box to return

paper

Paper, Default: 'letter'.

orientation

Orientation "portrait", "landscape", or "square", Default: 'portrait'.

geom

A character string indicating which ggplot2 geom to use, Default: 'sf'. Options include "sf" (ggplot2::geom_sf), "icon" (layer_icon), "markers" (layer_markers), "text" (ggplot2::geom_sf_text), and "label" (ggplot2::geom_sf_label). See details for a full list.

basemap

If FALSE, return a list of ggplot2 layers (or ggproto objects). If TRUE, add the list to ggplot2::ggplot() to return a map.

bg_layer, fg_layer

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.

save

If TRUE, save file with ggsave_ext or ggsave_social, requires basemap = TRUE and filename is not NULL or ... include a name parameter. Default: FALSE

name

Plot name, used to create filename (if filename is NULL) using make_filename()

label

Label to combine with name converted to snake case with janitor::make_clean_names(). The label is designed to identify the area or other shared characteristics across multiple data files, maps, or plots.

prefix

File name prefix. "date" adds a date prefix, "time" adds a date/time prefix; defaults to NULL.

postfix

File name postfix; defaults to NULL.

filename

File name to create on disk.

device

Device to use. Can either be a device function (e.g. png), or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only).

path

Path of the directory to save plot to: path and filename are combined to create the fully qualified file name. Defaults to the working directory.

dpi

Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types.

...

Additional parameters passed to layer_location_data.

image

Image size name, Default: NULL

platform

Social media platform, "Instagram", "Facebook", or "Twitter", Default: NULL

format

Image format, "post", "story", or "cover", Default: NULL

filetype

File type to use if passing parameters to read_sf_download or read_sf_pkg (required for extdata and cached data).

image_path

path to location of images for make_image_map()

style_url

A Mapbox style url; defaults to NULL.

image_geom

For make_image_map(), geom to use with layer_markers to mark the location of images (based on EXIF metadata).

groupname_col

Group column name, used to join group metadata if group_meta is a non-spatial data frame; Default: NULL

group_meta

Group metadata as a data frame or sf object that intersect with markers; Default: NULL

number

If TRUE, number markers using layer_markers() (not currently supported)

num_by_group

If TRUE, numbers are added by group based on groupname_col.

num_style

Style of enumeration, either "arabic", "alph", "Alph", "roman", "Roman"

num_start

Starting number; defaults to 1.

suffix

Character 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.

sort

Sort column name, Default: "dist_xmin_ymax".

desc

If TRUE, sort descending; default FALSE.

Details

Using make_image_map:

make_image_map wraps read_sf_exif and make_location_map. It is designed for making simple maps of photos in combination with reference tables.