| 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] (ORCID: <https://orcid.org/0000-0001-8280-1706>) |
| Maintainer: | Eli Pousson <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0.9000 |
| Built: | 2026-05-28 10:17:41 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_indexmd_arcgis_index
A data frame with 95 rows and 13 variables:
namecharacter Source name
operator.abbcharacter Operator abbreviation
operatorcharacter Operator name
citycharacter City name
countycharacter County name
statecharacter State name
state.abbcharacter State name abbreviation
geographycharacter Geographic scope; Options include citywide, countywide, regional (multi-county), statewide, or regional (multistate).
source_typecharacter Source type
notescharacter Notes
publiclogical Public data indicator
services_urlcharacter Services URL
hostingcharacter 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_districtsmd_arts_districts
A data frame with 29 rows and 12 variables:
nameDistrict name
descDistrict description
org_nameOrganization name
org_urlOrganization website URL
org_phoneOrganization phone number
org_addressOrganization street address
org_cityOrganization city
org_countyOrganization county
zipcodeOrganization zipcode
lonLongitude
latLatitude
geometryMULTIPOLYGON 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_placesmd_census_places
A data frame with 536 rows and 17 variables:
statefpState FIPS code for Maryland
countyCounty name
countyfpCounty FIPS code
placefpCDP FIPS code
placensCDP GNIS code
geoidUnique CDP GeoID
namePlace name
namelsadPlace Legal/statistical area description (LSAD)
lsadLegal/statistical area description (LSAD)
classfpClass FIPS code
pcicbsaCurrent metropolitan/micropolitan statistical area principal city indicator
mtfccMAF/TIGER Feature Class Code (MTFCC)
funcstatFunctional status
alandLand area (square meters)
awaterWater area (square meters)
intptlatLatitude of the internal point
intptlonLongitude of the internal point
geometrylist 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_districtsmd_congressional_districts
A data frame with 8 rows and 13 variables:
statefp2-character state FIPS code
cd116fp116th congressional district FIPS code
geoidGeoID
namelsadconcatenated variable with geographic area name and legal/statistical area description (LSAD)
lsadLegal/statistical area description (LSAD)
cdsessnCongressional session code
mtfccMAF/TIGER Feature Class Code (MTFCC)
funcstatfunctional status
alandland area (square meters)
awaterwater area (square meters)
intptlatlatitude of the internal point
intptlonlongitude of the internal point
labelCongressional District label
nameCongressional District name
geometryMultipolygon 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_countiesmd_counties
A data frame with 24 rows and 18 variables:
statefpState FIPS code for Maryland
countyfpCounty FIPS code
countynsCounty GNIS code
geoidUnique county FIPS code (concatenation of state and county FIPS codes)
nameCounty name
namelsadConcatenated variable length geographic area name and legal/statistical area description (LSAD)
lsadLegal/statistical area description (LSAD)
classfpFIPS class code
mtfccMAF/TIGER Feature Class Code (MTFCC)
csafpCombined statistical area code
cbsafpMetropolitan statistical area/micropolitan statistical area code
metdivfpMetropolitan division code
funcstatFunctional status
alandLand area (square meters)
awaterWater area (square meters)
intptlatLatitude of the internal point
intptlonLongitude of the internal point
regionRegion of the state
geometryMultipolygon 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_detailedmd_counties_detailed
A data frame with 24 rows and 6 variables:
statefpState FIPS code for Maryland
countyfpCounty FIPS code
nameCounty name
geoidUnique county GeoID (concatenation of state and county FIPS codes)
namelsadConcatenated variable length geographic area name and legal/statistical area description (LSAD)
geometryMultipolygon 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_2022md_house_districts_2022
A data frame with 71 rows and 6 variables:
nameDistrict name
idDistrict number
labelDistrict label
membersNumber of Delegates for district
popPopulation from 2020 U.S. Census
geometryDistrict boundary geometry
2022 Maryland Legislative Districts
Created using esriIndex function from the esri2sf package. Updated 2024-09-18.
md_imap_indexmd_imap_index
A data frame with 1,524 rows and 16 variables:
namecharacter Name
nmcharacter Name with snake case
typecharacter Service/layer type
urlcharacter Folder/service/layer URL
urlTypecharacter Index type
folderPathFolder path
serviceNamecharacter Service/layer type
serviceTypecharacter Service/layer type
idinteger Layer ID number
parentLayerIdinteger Parent layer ID number
defaultVisibilitylogical Layer default visibility
minScaledouble Minimum scale
maxScaleinteger Maximum scale
geometryTypecharacter Geometry type
subLayerIdslist Sublayer ID numbers
supportsDynamicLegendslogical Supports dynamic legends
Data from https://geodata.md.gov/imap/rest/services/BusinessEconomy/MD_IncentiveZones/FeatureServer/14
md_mposmd_mpos
A data frame with 7 rows and 6 variables:
geoidGeoID
nameMPO Name
abbMPO abbreviation or acronym
urlMPO website url
statesStates (multiple states separated by semi-colons)
geometryMULTIPOLYGON geometry for boundaries
Public resources from the Maryland Open Data Portal excluding resources cross-listed from Maryland iMap.
md_open_data_indexmd_open_data_index
A data frame with 737 rows and 11 variables:
nameResource name
nmResource name (snake case)
resourceResource identifier
descriptionDescription
urlResource URL
issuedDate issued
modifiedDate modified
keywordlist of keywords
identifierAPI identifier
themeData theme
licenseData 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_schoolsmd_schools
A data frame with 1,427 rows and 13 variables:
school_nameSchool name
addressStreet address
cityCity name
stateState
zipZip code
gradesGrades
school_typeSchool type
grade_bandGrade band
psc_numberPSC number
lss_numberLocal school system number as integer
countyCounty name
management_typeManagement type
geometryPOINT 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_2022md_senate_districts_2022
A data frame with 47 rows and 5 variables:
nameDistrict name
idDistrict number
labelDistrict label
popPopulation from 2020 U.S. Census
geometryDistrict 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_watermd_water
A data frame with 14,970 rows and 9 variables:
ansicodecharacter ANSI code
hydroidcharacter Hydroid
fullnamecharacter Full name
mtfcccharacter MAF/TIGER Feature Class Code
alanddouble Land area
awaterdouble Water area
intptlatcharacter Interior latitude point
intptloncharacter Interior longitude point
geometrylist 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_zctasmd_zctas
A data frame with 478 rows and 10 variables:
zcta5ce20ZCTA identifier
geoid20ZCTA GeoID
classfp20FIPS class code
mtfcc20MAF/TIGER Feature Class Code (MTFCC)
funcstat20Functional status
aland20Land area (square meters)
awater20Water area (square meters)
intptlat20Latitude of the internal point
intptlon20Longitude of the internal point
geometryMultipolygon 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_infomd_zoning_info
A data frame with 112 rows and 15 variables:
zoningZoning (no hyphenation)
zoning_altZoning (hyphenation)
nameZoning district name
categoryZoning district category
district_typeZoning district type
jurisdictionZoning jurisdiction
countyCounty
descriptionDescription
yearYear active
lot_size_restrictionNumeric value of lot size restriction (if provided)
lot_size_unitsUnits for lot size restriction value
articleArticle (for reference to code or ordinance)
page_numPage number (for reference to code or ordinance)
overlayOverlay district
repealedRepealed 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_enrollmentmsde_enrollment
A data frame with 219,741 rows and 10 variables:
yearSchool or academic year for enrollment count, e.g. 2019 data is from the start of the 2019-2020 school year.
school_numberSchool number as integer (0 indicates all schools)
school_nameSchool name
enrolled_countNumber 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.
gradeGrades from Prekindergarden (PK) to Grade 12
grade_rangeall 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.
raceRace/ethnicity. Enrollment by race/ethnicity is only available across all grades for years since 2020. "All" is used for data prior to 2020.
date_createdDate record created.
lss_numberLocal 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_nameLocal 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_colsreal_property_cols
A data frame with 223 rows and 6 variables:
field_orderField order
field_nameField name
data_typeData type
mdp_field_nameMaryland Department of Planning (MDP) Field name
api_field_nameMaryland Open Data portal API field name
sdat_field_numberState 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_mdus_states_near_md
A data frame with 7 rows and 15 variables:
regioncharacter Region ID
divisioncharacter Division ID
statefp2-character state FIPS code
statenscharacter State National Standard (NS) identifier using U.S. Geological Survey’s Geographic Names Information System (GNIS) code
geoidcharacter GeoID
stuspscharacter State U.S. Postal Service abbreviation
namecharacter State name
lsadLegal/statistical area description (LSAD)
mtfccMAF/TIGER Feature Class Code (MTFCC)
funcstatfunctional status
alandland area (square meters)
awaterwater area (square meters)
intptlatlatitude of the internal point
intptlonlongitude of the internal point
geometrylist Geometry