layer_area_data: Layer for area data

View source: R/layer_area_data.R

layer_area_dataR Documentation

Layer for area data

Description

[Deprecated]

This function is deprecated because the functionality has been incorporated into the improved maplayer::layer_location_data() function which uses a similar set of parameters.

Layer for ggplot to show data for an area or area bbox.

Combines get_area_data and geom_sf into a single call. Inherits data from ggplot() if data, extdata, and cachedata are left as NULL. Set asis to TRUE to keep data as is and not crop to area or modified area. Optionally can combine data layer with a mask layer, an area layer, and any additional number of layers after those three. The appearance of the area layer can be modified with fixed aesthetics using the area_aes parameter. Fixed aesthetics for the data layer can be added as additional parameters.

Usage

layer_area_data(
  area = NULL,
  bbox = NULL,
  data = NULL,
  extdata = NULL,
  cachedata = NULL,
  path = NULL,
  url = NULL,
  fn = NULL,
  asis = FALSE,
  diag_ratio = NULL,
  dist = NULL,
  asp = NULL,
  crop = TRUE,
  trim = FALSE,
  crs = pkgconfig::get_config("mapbaltimore.crs", 2804),
  mapping = ggplot2::aes(),
  inherit.aes = TRUE,
  show_mask = FALSE,
  show_area = FALSE,
  area_aes = list(color = "gray30"),
  layer_after = NULL,
  ...
)

Arguments

area

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

bbox

bbox object defining area used to filter data. If an area is provided, the bounding box is ignored.

data

sf object including data in area

extdata

Character. Name of an external geopackage (.gpkg) file included with the package where selected data is available. Available data includes "trees", "unimproved_property", and "vegetated_area"

cachedata

Character. Name of a cached geopackage (.gpkg) file where selected data is available. Running cache_mapbaltimore_data() caches data for "real_property", "baltimore_msa_streets", and "edge_of_pavement"

path

Character. Path to local or remote spatial data file supported by sf::st_read()

url

Character. URL for FeatureServer or MapServer layer to pass to get_area_esri_data.

fn

Function to apply to area data before returning.

asis

Logical. Default FALSE. If TRUE, use inherited data as is without cropping to area.

diag_ratio

ratio to set map extent based diagonal distance of area's bounding box. Ignored when dist is provided.

dist

buffer distance in meters. Optional.

asp

Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3").

crop

If TRUE, data cropped to area or bounding box sf::st_crop() adjusted by the dist, diag_ratio, and asp parameters provided. Default TRUE.

trim

If TRUE, data trimmed to area with sf::st_intersection(). This option is not supported for any adjusted areas that use the dist, diag_ratio, or asp parameters. Default FALSE.

crs

Coordinate Reference System (CRS) to use for the returned data. The CRS of the provided data and bounding box or area must match one another but are not required to match the CRS provided by this parameter.

show_mask

Logical. Default FALSE. If TRUE, add a mask using layer_area_mask

show_area

Logical. Default FALSE. If TRUE, add an outline of the area to the layer.

area_aes

List of fixed aesthetics for area layer. Default to list(color = "gray30", fill = NA). Supported aesthetics include color, fill, linetype, alpha, and size. Defaults to color = "gray30", fill = NA, size = 0.75, alpha = 1, linetype = 0. Default aesthetics for geom_sf are ignored.

layer_after

ggplot objects to append to the end of the data, mask, area layer list. This is intended to be used to append scales, guides, or labels related to the the data layer.

...

Arguments passed on to ggplot2::geom_sf, ggplot2::geom_sf

mapping

Set of aesthetic mappings created by aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders().

Predefined layers

NA


elipousson/mapbaltimore documentation built on Nov. 11, 2024, 8:25 p.m.