Title: | Easy Access to Maryland Spatial Data |
---|---|
Description: | A small collection of data sources and utility functions for working with state and county data sources in Maryland. |
Authors: | Eli Pousson [aut, cre, cph] |
Maintainer: | Eli Pousson <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0.9000 |
Built: | 2024-10-29 05:17:02 UTC |
Source: | https://github.com/elipousson/mapmaryland |
cache_imap_data()
is a wrapper for get_imap_data()
and
getdata::cache_location_data()
that save a layer from Maryland iMap or a
subset of a layer to a local file. By default, the data is saved to the
mapmaryland package cache folder.
cache_imap_data( data = NULL, nm = NULL, ..., location = NULL, name = NULL, label = NULL, fileext = "gpkg", filename = NULL, path = NULL, prefix = NULL, postfix = NULL, cache = TRUE, pkg = "getdata", create = TRUE, overwrite = FALSE, call = caller_env() )
cache_imap_data( data = NULL, nm = NULL, ..., location = NULL, name = NULL, label = NULL, fileext = "gpkg", filename = NULL, path = NULL, prefix = NULL, postfix = NULL, cache = TRUE, pkg = "getdata", create = TRUE, overwrite = FALSE, call = caller_env() )
data |
Data to pass to |
nm |
Layer name identifier used to retrieve url from |
... |
Additional parameters passed to |
location |
A |
name |
Name to make file name converted to snake case with
|
label |
Label to combine with name converted to snake case with
|
fileext |
File type or extension. Optional if filename or path include a file extension. |
filename |
File name; if filename is |
path |
Path to file or data directory. Optional. If path includes a file
extension and filename and fileext are both |
prefix |
File name prefix. "date" adds a date prefix, "time" adds a
date/time prefix; defaults to |
postfix |
File name postfix; defaults to |
cache |
If |
pkg |
Package name passed to appname parameter of
|
create |
If |
overwrite |
If |
call |
The execution environment of a currently
running function, e.g. |
Convert the coordinate reference system, convert invalid geometry to valid
geometry with sf::st_make_valid()
, and, optionally, erase water, and clean
names with janitor::clean_names()
.
format_md_sf( data, crs = getOption("mapmaryland.crs", default = 3857), erase_water = FALSE, erase_data = NULL, clean_names = TRUE, dTolerance = NULL, smooth = FALSE, sf_col = "geometry", ... )
format_md_sf( data, crs = getOption("mapmaryland.crs", default = 3857), erase_water = FALSE, erase_data = NULL, clean_names = TRUE, dTolerance = NULL, smooth = FALSE, sf_col = "geometry", ... )
data |
A |
crs |
coordinate reference system. Defaults to
|
erase_water |
If |
erase_data |
A |
clean_names |
If |
dTolerance |
numeric; tolerance parameter, specified for all or for each
feature geometry. If you run |
smooth |
If |
sf_col |
Name to use for output |
... |
Additional parameters passed to |
A modified version of the input simple feature data.
Get data from Maryland iMap including Computer Assisted Mass Appraisal (CAMA), parcel data, Maryland Inventory of Historic Properties data, and a variety of water data.
get_imap_data( location = NULL, nm = NULL, crs = getOption("mapmaryland.crs", default = 3857), ... ) get_cama_data( location, type = "core", crs = getOption("mapmaryland.crs", default = 3857), ... ) get_parcel_data( location, type = "boundaries", crs = getOption("mapmaryland.crs", default = 3857), block = FALSE, ... ) format_parcel_data( data, imap_addr_cols = list(bldg_num = "strtnum", street_dir_prefix = "strtdir", street_name = "strtnam", street_suffix = "strttyp") ) get_mht_data( location, type = "mihp", crs = getOption("mapmaryland.crs", default = 3857), ... ) get_water_data( location, type = "streams", crs = getOption("mapmaryland.crs", default = 3857), ... ) get_imap_url(nm = NULL)
get_imap_data( location = NULL, nm = NULL, crs = getOption("mapmaryland.crs", default = 3857), ... ) get_cama_data( location, type = "core", crs = getOption("mapmaryland.crs", default = 3857), ... ) get_parcel_data( location, type = "boundaries", crs = getOption("mapmaryland.crs", default = 3857), block = FALSE, ... ) format_parcel_data( data, imap_addr_cols = list(bldg_num = "strtnum", street_dir_prefix = "strtdir", street_name = "strtnam", street_suffix = "strttyp") ) get_mht_data( location, type = "mihp", crs = getOption("mapmaryland.crs", default = 3857), ... ) get_water_data( location, type = "streams", crs = getOption("mapmaryland.crs", default = 3857), ... ) get_imap_url(nm = NULL)
location |
A |
nm |
Layer name identifier used to retrieve url from |
crs |
Coordinate reference system to return. Defaults to
|
... |
Additional parameters passed to |
type |
Default and supported options vary by function. See details. |
block |
If block is |
data |
Data to pass to |
imap_addr_cols |
Named list with address column names for input data.
Passed to corresponding parameters in |
Options for type parameter:
get_cama_data()
: Default: "core"; options: "bldg" (detailed building
characteristics), "core", "land", "subarea" (building subarea).
get_water_data()
: Default: "streams", options: "streams" (Rivers and
streams generalized), "streams detailed" (Rivers and streams generalized),
"federal watersheds", "8 digit watersheds", "12 digit watersheds", "navigable
waterways", "ponds" (Lakes and ponds)
get_parcel_data()
: Default "boundaries", options: "boundaries" (Parcel
boundaries), "points" (Parcel points)
get_mht_data()
: Default: "mihp"; options: "mihp" (Maryland Inventory of
Historic Properties), "nr" (National Register of Historic Places),
"easements" (Preservation Easements held by the Maryland Historical Trust)
Helper functions:
format_parcel_data()
is a wrapper for getdata::bind_block_col()
used by
get_parcel_data()
get_imap_url()
is a look-up function for the md_imap_index
using the
short "nm" column as a index.
Get crash data using get_md_open_data()
. format_md_crash_data works with
a data frame of crash data from get_md_crash_data()
when type = "crashes".
format_md_crashes_person()
formats data when type = "persons".
format_md_crashes()
calls one or the other depending on the type
parameter.
get_md_crash_data( location = NULL, ..., report_no = NULL, where = NULL, type = "crashes" ) format_md_crash_data(data, type = "crashes", drop_code = TRUE, ...) format_md_crashes(data) format_md_crash_date(data, cols = c("acc_date", "acc_time")) format_md_crashes_person( data, start_year = 2022, end_year = 2022, na_dates = c("1/1/1900", "19000101", "19001111", "19001212", "19200202") )
get_md_crash_data( location = NULL, ..., report_no = NULL, where = NULL, type = "crashes" ) format_md_crash_data(data, type = "crashes", drop_code = TRUE, ...) format_md_crashes(data) format_md_crash_date(data, cols = c("acc_date", "acc_time")) format_md_crashes_person( data, start_year = 2022, end_year = 2022, na_dates = c("1/1/1900", "19000101", "19001111", "19001212", "19200202") )
location |
A |
... |
Passed to |
report_no |
Crash report numbers. Defaults to |
where |
A query parameter passed to |
type |
Supported options include "crashes" (default), "persons" (or "crashes_person"), and "vehicles" (or "crashes_vehicle"). |
data |
Data frame with Maryland vehicular crash data; typically from
|
drop_code |
If |
cols |
Column names to use with |
start_year , end_year
|
Start and end year to use when checking validity of birth dates. |
na_dates |
Character vector of invalid dates to replace with a
|
## Not run: if (interactive()) { get_md_crash_data( where = "(year = '2020') AND (quarter = 'Q2')", name_col = "county_desc", name = "Cecil" ) } ## End(Not run)
## Not run: if (interactive()) { get_md_crash_data( where = "(year = '2020') AND (quarter = 'Q2')", name_col = "county_desc", name = "Cecil" ) } ## End(Not run)
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".
get_md_open_data( resource = NULL, type = NULL, crs = getOption("mapmaryland.crs", default = 3857), geometry = FALSE, token = NULL, ... )
get_md_open_data( resource = NULL, type = NULL, crs = getOption("mapmaryland.crs", default = 3857), geometry = FALSE, token = NULL, ... )
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
|
geometry |
If |
token |
Optional access token or API Key to pass to
|
... |
Arguments passed on to
|
Get package data with Maryland counties, U.S. Congressional District, or Census designated places by name or GeoID or use the tigris package to download state data.
get_md_tigris( name = NULL, type = "counties", crs = getOption("mapmaryland.crs", default = 3857), erase_water = FALSE, ... )
get_md_tigris( name = NULL, type = "counties", crs = getOption("mapmaryland.crs", default = 3857), erase_water = FALSE, ... )
name |
Name matching a value in the namelsad, namelsad, or geoid columns
of md_counties, md_census_places, md_congressional_districts, or one
of the data sets available for download with {tigris}; Default: |
type |
Type of data to return, Default: "counties"; See details for supported options. |
crs |
coordinate reference system. Defaults to
|
erase_water |
If |
... |
Additional parameters passed on to {tigris} functions. |
Use {mapmaryland} packaged data or use tigris U.S. Census Bureau API:
Supported options that access data included with the {mapmaryland} package include "counties", "census places", "congressional districts", "legislative districts", and "water".
Options that access data by calling one of several tigris functions for downloading data from the U.S. Census Bureau API include "senate district", "tracts", "block groups", "blocks", "pumas", "voting districts", "zctas", "roads", "primary secondary roads", "area water", "linear water", and "landmarks".
tigris functions that do not use a "state" parameter (e.g. tigris::coastline or tigris::rails) are not supported by this function.
A simple feature object matching the type provided.
A non-comprehensive list of ArcGIS services maintained by public agencies, academic units, and nonprofit organizations in Maryland. Layers available at the service_url can be accessed using the esri2sf package.
md_arcgis_index
md_arcgis_index
A data frame with 95 rows and 13 variables:
name
character Source name
operator.abb
character Operator abbreviation
operator
character Operator name
city
character City name
county
character County name
state
character State name
state.abb
character State name abbreviation
geography
character Geographic scope; Options include citywide, countywide, regional (multi-county), statewide, or regional (multistate).
source_type
character Source type
notes
character Notes
public
logical Public data indicator
services_url
character Services URL
hosting
character Hosting type; Currently used as an indicator for ArcGIS Online hosted data with other services assumed to be self-hosted by the source or operator.
Comments, additions, or corrections can be submitted using comments on this open Google Sheet: https://docs.google.com/spreadsheets/d/1c829bZdNqvbpoizulBU_XE5jVeNNck2kHkS-smpQ52s/edit?usp=sharing
Data last updated from Google Sheet 2024-09-18.
The Maryland State Arts Council sponsors Arts & Entertainment Districts as a way to stimulate the economy and improve quality of life. This legislation enables local jurisdictions, municipalities, counties, or a combination thereof, to apply for state designations for the Arts and Entertainment Districts within their boundaries and offer tax incentives as provided by law. More information from the Maryland State Arts Council: https://msac.org/programs/arts-entertainment-districts
md_arts_districts
md_arts_districts
A data frame with 29 rows and 12 variables:
name
District name
desc
District description
org_name
Organization name
org_url
Organization website URL
org_phone
Organization phone number
org_address
Organization street address
org_city
Organization city
org_county
Organization county
zipcode
Organization zipcode
lon
Longitude
lat
Latitude
geometry
MULTIPOLYGON geometry with boundaries
https://geodata.md.gov/imap/rest/services/BusinessEconomy/MD_IncentiveZones/FeatureServer/2
Census Designated Places (CDPs) in the state of Maryland downloaded using the tigris::places function. Updated 2024-10-29.
md_census_places
md_census_places
A data frame with 536 rows and 17 variables:
statefp
State FIPS code for Maryland
county
County name
countyfp
County FIPS code
placefp
CDP FIPS code
placens
CDP GNIS code
geoid
Unique CDP GeoID
name
Place name
namelsad
Place Legal/statistical area description (LSAD)
lsad
Legal/statistical area description (LSAD)
classfp
Class FIPS code
pcicbsa
Current metropolitan/micropolitan statistical area principal city indicator
mtfcc
MAF/TIGER Feature Class Code (MTFCC)
funcstat
Functional status
aland
Land area (square meters)
awater
Water area (square meters)
intptlat
Latitude of the internal point
intptlon
Longitude of the internal point
geometry
list COLUMN_DESCRIPTION
U.S. Congressional Districts boundaries downloaded from the U.S. Census Bureau with the tigris::congressional_districts function. Updated 2024-10-29.
md_congressional_districts
md_congressional_districts
A data frame with 8 rows and 13 variables:
statefp
2-character state FIPS code
cd116fp
116th congressional district FIPS code
geoid
GeoID
namelsad
concatenated variable with geographic area name and legal/statistical area description (LSAD)
lsad
Legal/statistical area description (LSAD)
cdsessn
Congressional session code
mtfcc
MAF/TIGER Feature Class Code (MTFCC)
funcstat
functional status
aland
land area (square meters)
awater
water area (square meters)
intptlat
latitude of the internal point
intptlon
longitude of the internal point
label
Congressional District label
name
Congressional District name
geometry
Multipolygon with district boundary
County boundaries downloaded from the U.S. Census Bureau with the tigris::counties function. Counties in the Baltimore–Columbia–Towson Metropolitan Statistical Area (MSA) include Baltimore City, Baltimore County, Carroll County, Anne Arundel County, Howard County, Queen Anne's County, and Harford County. Counties in the DC-VA-MD-WV Metropolitan Statistical Area (MSA) include Montgomery, Frederick, Prince George's, Charles, and Calvert counties. Regions are based on this resource from Visit Maryland https://www.visitmaryland.org/info/maryland-regions. Updated 2024-10-29.
md_counties
md_counties
A data frame with 24 rows and 18 variables:
statefp
State FIPS code for Maryland
countyfp
County FIPS code
countyns
County GNIS code
geoid
Unique county FIPS code (concatenation of state and county FIPS codes)
name
County name
namelsad
Concatenated variable length geographic area name and legal/statistical area description (LSAD)
lsad
Legal/statistical area description (LSAD)
classfp
FIPS class code
mtfcc
MAF/TIGER Feature Class Code (MTFCC)
csafp
Combined statistical area code
cbsafp
Metropolitan statistical area/micropolitan statistical area code
metdivfp
Metropolitan division code
funcstat
Functional status
aland
Land area (square meters)
awater
Water area (square meters)
intptlat
Latitude of the internal point
intptlon
Longitude of the internal point
region
Region of the state
geometry
Multipolygon with the county boundary
https://www.census.gov/geo/maps-data/data/tiger-line.html
Detailed boundaries for Maryland counties from Maryland iMap.
md_counties_detailed
md_counties_detailed
A data frame with 24 rows and 6 variables:
statefp
State FIPS code for Maryland
countyfp
County FIPS code
name
County name
geoid
Unique county GeoID (concatenation of state and county FIPS codes)
namelsad
Concatenated variable length geographic area name and legal/statistical area description (LSAD)
geometry
Multipolygon with the county boundary
From the Maryland Department of Planning: "The Maryland General Assembly, under the Maryland Constitution, adopted new state legislative districts on February 1, 2022, based on the changes in population reported in the 2020 U.S. Census and adjusted in accordance with Maryland's No Representation Without Population Act of 2010."
md_house_districts_2022
md_house_districts_2022
A data frame with 71 rows and 6 variables:
name
District name
id
District number
label
District label
members
Number of Delegates for district
pop
Population from 2020 U.S. Census
geometry
District boundary geometry
2022 Maryland Legislative Districts
Created using esriIndex function from the esri2sf package. Updated 2024-09-18.
md_imap_index
md_imap_index
A data frame with 1,524 rows and 16 variables:
name
character Name
nm
character Name with snake case
type
character Service/layer type
url
character Folder/service/layer URL
urlType
character Index type
folderPath
Folder path
serviceName
character Service/layer type
serviceType
character Service/layer type
id
integer Layer ID number
parentLayerId
integer Parent layer ID number
defaultVisibility
logical Layer default visibility
minScale
double Minimum scale
maxScale
integer Maximum scale
geometryType
character Geometry type
subLayerIds
list Sublayer ID numbers
supportsDynamicLegends
logical Supports dynamic legends
Data from https://geodata.md.gov/imap/rest/services/BusinessEconomy/MD_IncentiveZones/FeatureServer/14
md_mpos
md_mpos
A data frame with 7 rows and 6 variables:
geoid
GeoID
name
MPO Name
abb
MPO abbreviation or acronym
url
MPO website url
states
States (multiple states separated by semi-colons)
geometry
MULTIPOLYGON geometry for boundaries
Public resources from the Maryland Open Data Portal excluding resources cross-listed from Maryland iMap.
md_open_data_index
md_open_data_index
A data frame with 737 rows and 11 variables:
name
Resource name
nm
Resource name (snake case)
resource
Resource identifier
description
Description
url
Resource URL
issued
Date issued
modified
Date modified
keyword
list of keywords
identifier
API identifier
theme
Data theme
license
Data license
Combined iMap FeatureLayer for traditional public schools and charter schools. The school number previously included in this dataset was incomplete due to the iMap data using a different school name than the MSDE data for a little less than half of schools in the state. As of February 2023, the school number column has been removed to ensure the data is accurate and to avoid confusion. For charter schools, the school_type column has been added based on the grade range. Data based on iMap data layers as of 2023 February 10 for public schools https://geodata.md.gov/imap/rest/services/Education/MD_EducationFacilities/FeatureServer/5 and charter schools https://geodata.md.gov/imap/rest/services/Education/MD_EducationFacilities/FeatureServer/6
md_schools
md_schools
A data frame with 1,427 rows and 13 variables:
school_name
School name
address
Street address
city
City name
state
State
zip
Zip code
grades
Grades
school_type
School type
grade_band
Grade band
psc_number
PSC number
lss_number
Local school system number as integer
county
County name
management_type
Management type
geometry
POINT geometry
From the Maryland Department of Planning: "The Maryland General Assembly, under the Maryland Constitution, adopted new state legislative districts on February 1, 2022, based on the changes in population reported in the 2020 U.S. Census and adjusted in accordance with Maryland's No Representation Without Population Act of 2010."
md_senate_districts_2022
md_senate_districts_2022
A data frame with 47 rows and 5 variables:
name
District name
id
District number
label
District label
pop
Population from 2020 U.S. Census
geometry
District boundary geometry
2022 Maryland Legislative Districts
Detailed multipolygon data for streams, lakes, and other water in the state of Maryland downloaded from the U.S. Census Bureau with the tigris::area_water function. Updated 2024-10-29.
md_water
md_water
A data frame with 14,970 rows and 9 variables:
ansicode
character ANSI code
hydroid
character Hydroid
fullname
character Full name
mtfcc
character MAF/TIGER Feature Class Code
aland
double Land area
awater
double Water area
intptlat
character Interior latitude point
intptlon
character Interior longitude point
geometry
list Multipolygon geometry
https://data.imap.maryland.gov/datasets/maryland-waterbodies-rivers-and-streams-detailed
ZIP Code Tabulation Areas (ZCTAs) are generalized areal representations of
United States Postal Service (USPS) ZIP Code service areas downloaded using
the tigris::zctas()
function. Updated 2024-10-29.
md_zctas
md_zctas
A data frame with 478 rows and 10 variables:
zcta5ce20
ZCTA identifier
geoid20
ZCTA GeoID
classfp20
FIPS class code
mtfcc20
MAF/TIGER Feature Class Code (MTFCC)
funcstat20
Functional status
aland20
Land area (square meters)
awater20
Water area (square meters)
intptlat20
Latitude of the internal point
intptlon20
Longitude of the internal point
geometry
Multipolygon with the ZCTA boundary
https://www.census.gov/programs-surveys/geography/guidance/geo-areas/zctas.html
An incomplete index of zoning district names and categories for Maryland counties and local jurisdictions. Updated based on this Google Sheet: https://docs.google.com/spreadsheets/d/1qu8s3W9tvtMPvqLNpzrxqybqPSnl67aBBItSWRgbdto/edit?usp=sharing
md_zoning_info
md_zoning_info
A data frame with 112 rows and 15 variables:
zoning
Zoning (no hyphenation)
zoning_alt
Zoning (hyphenation)
name
Zoning district name
category
Zoning district category
district_type
Zoning district type
jurisdiction
Zoning jurisdiction
county
County
description
Description
year
Year active
lot_size_restriction
Numeric value of lot size restriction (if provided)
lot_size_units
Units for lot size restriction value
article
Article (for reference to code or ordinance)
page_num
Page number (for reference to code or ordinance)
overlay
Overlay district
repealed
Repealed zoning district name/type
Enrollment data from the Maryland State Department of Education (MSDE). This data is copied from the marylandedu R data package. Refer to that package for more detailed documentation. Variable definitions are based on the definitions from the MSDE website.
msde_enrollment
msde_enrollment
A data frame with 219,741 rows and 10 variables:
year
School or academic year for enrollment count, e.g. 2019 data is from the start of the 2019-2020 school year.
school_number
School number as integer (0 indicates all schools)
school_name
School name
enrolled_count
Number of students registered to attend the school at the start of the year in the grade or grade range as integer. Typically enrollment count is as of September 30.
grade
Grades from Prekindergarden (PK) to Grade 12
grade_range
all elementary school Grades, all middle school grades, all high school grades, or all grades (total enrollment). May also be used as a label for grade.
race
Race/ethnicity. Enrollment by race/ethnicity is only available across all grades for years since 2020. "All" is used for data prior to 2020.
date_created
Date record created.
lss_number
Local school system (LSS) number as integer. NA is used in place of a LSS number for statewide data. Older LEA numbers are combined with LSS numbers in this dataset.
lss_name
Local school system (LSS) names (typically same as county name). "State" is used in place of a LSS name for statewide data. Older LEA names are combined with LSS names in this dataset.
Maryland Real Property Assessments (fields reference)
real_property_cols
real_property_cols
A data frame with 223 rows and 6 variables:
field_order
Field order
field_name
Field name
data_type
Data type
mdp_field_name
Maryland Department of Planning (MDP) Field name
api_field_name
Maryland Open Data portal API field name
sdat_field_number
State Department of Assessments and Taxation (SDAT) field number
Currently only used for mapmaryland.crs
set_mapmaryland_options(crs = NULL, overwrite = TRUE)
set_mapmaryland_options(crs = NULL, overwrite = TRUE)
crs |
Coordinate reference system to set, e.g. "crs = 2804" to set "mapmaryland.crs" to 2804. |
overwrite |
If |
U.S. states bordering Maryland or in close proximity. Updated 2024-10-29.
us_states_near_md
us_states_near_md
A data frame with 7 rows and 15 variables:
region
character Region ID
division
character Division ID
statefp
2-character state FIPS code
statens
character State National Standard (NS) identifier using U.S. Geological Survey’s Geographic Names Information System (GNIS) code
geoid
character GeoID
stusps
character State U.S. Postal Service abbreviation
name
character State name
lsad
Legal/statistical area description (LSAD)
mtfcc
MAF/TIGER Feature Class Code (MTFCC)
funcstat
functional status
aland
land area (square meters)
awater
water area (square meters)
intptlat
latitude of the internal point
intptlon
longitude of the internal point
geometry
list Geometry