get_maryland_open_resource: Get dataset from Maryland Open Data portal with optional SoQL...

View source: R/get_maryland_open_resource.R

get_maryland_open_resourceR Documentation

Get dataset from Maryland Open Data portal with optional SoQL parameters

Description

[Deprecated]

This function was deprecated as the functionality is now available in by mapmaryland::get_md_open_data() which wraps the more general getdata::get_open_data() function.

Get a selected dataset using Socrata Query Language (SoQL) parameters as a tibble or sf object. Details on SoQL queries are found in the Socrata API documentation https://dev.socrata.com/docs/queries/

Usage

get_maryland_open_resource(
  resource = NULL,
  select = NULL,
  where = NULL,
  query = NULL,
  geometry = FALSE,
  area = NULL,
  bbox = NULL,
  longitude = "longitude",
  latitude = "latitude",
  trim = FALSE,
  key = Sys.getenv("MARYLAND_OPEN_DATA_API_KEY"),
  crs = pkgconfig::get_config("mapbaltimore.crs", 2804)
)

Arguments

resource

Socrata dataset identifier for selected dataset from Maryland's Open Data portal

select

SODA $select parameter. Set of columns to be returned, similar to a SELECT in SQL. https://dev.socrata.com/docs/queries/select.html

where

SODA $where parameter. Filters the rows to be returned, similar to WHERE. https://dev.socrata.com/docs/queries/where.html

query

SODA $query parameter. A full SoQL query string, all as one parameter. https://dev.socrata.com/docs/queries/query.html

geometry

If TRUE and latitude/longitude columns available, return a sf() object. Default FALSE.

area

sf object used to generate bbox (only used if bbox is NULL). Required to use trim parameter. Default NULL.

bbox

bbox object generate query for non-spatial resources with latitude and longitude columns. Default NULL.

longitude

Name of column containing longitude data, Default: 'longitude'

latitude

Name of column containing latitude data, Default: 'latitude'

trim

If area is provided, trim data to the area boundary rather than the bounding box, Default: FALSE. area must be provided if TRUE.

crs

Coordinate reference system to return.

Examples

## Not run: 
## Get Q2 2020 vehicle crash data for Cecil County, Maryland
get_maryland_open_resource(
  resource = "65du-s3qu",
  where = "(year = '2020') AND (quarter = 'Q2') AND county_desc like 'Cecil'"
)

## End(Not run)

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