get_area_requests: Get area 311 service requests from Open Baltimore

View source: R/get_area_requests.R

get_area_requestsR Documentation

Get area 311 service requests from Open Baltimore

Description

Get 311 service requests for a specific area. Service requests from 2017 to 2020 area available but only a single year can be requested at a time. Duplicate requests are removed from the returned data. Requests can be filtered by request type, responsible city agency, or both. You can return multiple types or agencies, by using a custom where query parameter or by calling each type/agency separately.

Usage

get_area_requests(
  area = NULL,
  year = 2022,
  date_range = NULL,
  request_type = NULL,
  agency = NULL,
  where = NULL,
  dist = NULL,
  diag_ratio = NULL,
  unit = "m",
  asp = NULL,
  trim = FALSE,
  geometry = TRUE,
  crs = pkgconfig::get_config("mapbaltimore.crs", 2804),
  duplicates = FALSE,
  ...
)

Arguments

area

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

year

Year for service requests. Default 2021. 2017 to 2022 supported.

date_range

Date range as character vector in format of c("YYYY-MM-DD", "YYYY-MM-DD"). Minimum and maximum values are used if length is greater than 1.

request_type

Service request type.

agency

City agency responsible for request. Options include "Transportation", "BGE", "Solid Waste", "Housing", "Water Wastewater", "Health", "Call Center", "Finance", "Liquor Board", "Recreation & Parks", "Fire Department", "Parking Authority", and "General Services"

where

string for where condition. This parameter is ignored if a request_type or agency are provided.

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.

trim

If TRUE, x is trimmed to y with st_trim().

geometry

Default TRUE. If FALSE, return requests with missing latitude/longitude (for years prior to 2021 only).

crs

Cordinate reference system to return, Default: 4326 for sf_to_df() and NULL for df_to_sf().

duplicates

If TRUE, return 311 service requests marked as "Duplicate". If FALSE, filter duplicate requests out of results.

...

Arguments passed on to esri2sf::esri2sf

outFields

vector of fields you want to include. default is NULL for all fields.

replaceDomainInfo

If TRUE, add domain information to the return data frame. Default FALSE.

Examples

# Get boundary for Edmondson Village
area <- get_area("neighborhood", "Edmondson Village")

# Get fallen limb requests for 2022
get_area_requests(
  area = area,
  date_range = c("2022-11-01", "2022-12-31"),
  request_type = "FOR-Fallen Limb"
)

# Get dirty alley service requests for multiple years using purrr::map_dfr()
purrr::list_rbind(
  purrr::map(
    c(2021, 2020),
    ~ get_area_requests(
      area = area,
      year = .x,
      request_type = "SW-Dirty Alley"
    )
  )
)


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