Wrap getdata::get_open_data to access the Maryland Open Data portal. The source url can be set with an option named "mapmaryland.open_data_source_url" but it defaults to the statewide open data portal https://opendata.maryland.gov The token type can be set with an option named "mapmaryland.open_data_token_type" but it defaults to "MARYLAND_OPEN_DATA_API_KEY".
Usage
get_md_open_data(
resource = NULL,
type = NULL,
crs = getOption("mapmaryland.crs", default = 3857),
geometry = FALSE,
token = NULL,
...
)Arguments
- resource
Resource identifier code passed to "data" parameter of getdata::get_open_data
- type
Type of data to return. Supported options: "crashes", "road closures", "bay pollution reduction"
- crs
Coordinate reference system of bounding box to return; defaults to
NULLwhich maintains the crs of the input object.- geometry
If
TRUEand coords are provided, return asfobject. DefaultFALSE.- token
Optional access token or API Key to pass to
getdata::set_access_token(). The token type variable is set bygetOption("mapmaryland.open_data_token_type", default = "MARYLAND_OPEN_DATA_API_KEY")- ...
Arguments passed on to
getdata::get_open_datadataA data set identifier (known as a resource for Socrata) or a url for an individual dataset. If data is set to "list" and a valid source_url is provided, the function returns a list of all available resources. If data is a url, source_url must be NULL. get_socrata_metadata requires the data parameter.
source_urlA data source url. For Socrata, this should the base url for the open data portal.
source_typeData source type; defaults to "socrata" which is currently the only supported option.
selectNames of of columns to return or transformed, equivalent to a SELECT in SQL. Passed to SODA $select parameter, see https://dev.socrata.com/docs/queries/select.html for more information.
whereCondition to filters the rows to return, equivalent to WHERE in SQL. Passed to the SODA $where parameter, see https://dev.socrata.com/docs/queries/where.html for more information.
queryA full SoQL query string, all as one parameter. Passed to the SODA $query parameter, see https://dev.socrata.com/docs/queries/query.html for more information.
locationsf object. If multiple areas are provided, they are unioned into a single sf object using
sf::st_union()distbuffer distance in units. Optional.
diag_ratioratio 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
distis provided.unitUnits 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"
aspAspect 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.name,name_colName of column in Socrata data resource with location names (e.g. County) and name of location to return.
location_colName of a "location" or "point" type column in a Socrata dataset.
coordsCoordinate columns for input data.frame or output sf object (if geometry is 'centroid' or 'point') Default: c("lon", "lat").
token,typeAccess token or API Key and token type (name used to store token in .Renvironment). A token may be required to access data from Socrata and other open data portals but can be stored as an environment variable with set_access_token.
from_crsCoordinate reference system used to match the location CRS to the source data.
clean_namesIf
TRUE, clean names provided to nm or created based on value of col using janitor::clean_names. IfFALSE, use names as provided.quietIf
TRUE, suppress messages when downloading data. Defaults toFALSE..name_repairOne of "unique", "universal", or "check_unique". See
vctrs::vec_as_names()for the meaning of these options.