get_area: Get area of selected type

View source: R/get_area.R

get_areaR Documentation

Get area of selected type

Description

Get a sf object with one or more neighborhoods, Baltimore City Council districts, Maryland Legislative Districts, U.S. Congressional Districts, Baltimore Planning Districts, Baltimore Police Districts, or Community Statistical Areas, park districts, or Census blocks, block groups, or tracts. Area type is required and can be used in combination with area name, area id (not supported by all data sets), or location (as an address or sf object). Name and id are not supported for U.S. Census geogrpahies. Use the location parameter to return any areas of the selected type that intersect with the specified location. get_baltimore_area() has different parameter names (more consistent with getdata::get_location()) and is now recommended over get_area() to avoid a name conflict with the sfext::get_area() function.

Usage

get_area(
  type = c("neighborhood", "council district", "legislative district",
    "congressional district", "planning district", "police district", "csa",
    "park district", "block", "block group", "tract"),
  area_name = NULL,
  area_id = NULL,
  location = NULL,
  union = FALSE,
  area_label = NULL
)

get_baltimore_area(
  type = NULL,
  name = NULL,
  id = NULL,
  location = NULL,
  union = FALSE,
  label = NULL
)

get_neighborhood(name, location = NULL, union = FALSE, ...)

Arguments

type

Required. Area type matching one of the boundary datasets included with mapbaltimore. Supported values include "neighborhood", "council district", "legislative district", "congressional district", "planning district", "police district", "csa", "park district". U.S. Census geographies including "block", "block group", and "tract" are supported when using the location parameter only.

area_name

name or names matching id column in data of selected dataset. Character.

area_id

identifier or identifiers matching id column of selected dataset. Not all supported datasets have an id column and the id may be an integer or character depending on the dataset.

location

Location supports to types of values: an address that can be geocoded using tidygeocoder::geo() or an sf object that intersects with the selected area types. If using an sf object, the CRS for the object must be EPSG:2804.

union

If TRUE and multiple area names are provided, the area geometry is combined with sf::st_union(). Defaults to FALSE.

area_label

Label to use as name for area if union is TRUE or as additional label column if union is FALSE. If union is TRUE and area_label is not provided, the original area names are concatenated into a single string.

name

Passed to area_name by get_baltimore_area()

id

Passed to area_id by get_baltimore_area()

label

Passed to area_label by get_baltimore_area()

...

Additional parameters passed by get_neighborhood() to get_area()

See Also

neighborhoods,council_districts,legislative_districts, congressional_districts,planning_districts,police_districts,csas, park_districts tidygeocoder::geo()

Examples

# Get the Harwood neighborhood by name
get_area(
  type = "neighborhood",
  area_name = "Harwood"
)

# Get City Council District 12 and 14 by id
get_area(
  type = "council district",
  area_id = c(12, 14)
)

# Get the east and southeast planning districts and combine them
get_area(
  type = "planning district",
  area_id = c("East", "Southeast"),
  union = TRUE,
  area_label = "East and Southeast Planning Districts"
)

# Get legislative district for Walters Art Museum (600 N Charles St)
get_area(
  type = "legislative district",
  location = "600 N Charles St, Baltimore, MD 21201"
)

# Get Census tracts for the Edmondson Village neighborhood
get_area(
  type = "tract",
  location = get_area("neighborhood", "Edmondson Village")
)

elipousson/mapbaltimore documentation built on April 2, 2024, 4:23 p.m.