diff --git a/NEWS.md b/NEWS.md index 94bb36f..6d83297 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,7 @@ * Update `parks` data to use new BCRP layer that includes community green spaces and other non-city owned open spaces (2023-10-16). * Update `mta_bus_stops` to use current winter 2023 service data and correct issue with frequency variable where stops with frequent service had not been identified as such. * Update `baltimore_water` data (2023-11-08) to add an acres column and fill in the name column based on intersections with the `mapmaryland::md_water` data. +* Update `inspire_plans` to add `program_numbers` column (2024-03-29). ## New or modified functions diff --git a/R/data.R b/R/data.R index f1908d3..b90ee8a 100644 --- a/R/data.R +++ b/R/data.R @@ -1043,7 +1043,9 @@ #' #' Data frame and boundary geometry for INSPIRE Plans adopted and in progress. #' -#' @format A data frame with 24 rows and 19 variables: +#' Last updated: 2024-03-29 +#' +#' @format A data frame with 24 rows and 23 variables: #' \describe{ #' \item{`plan_name`}{Plan name} #' \item{`plan_name_short`}{Plan name (short)} @@ -1063,6 +1065,7 @@ #' \item{`recommendations_date_target`}{Target draft recommendation report publication date} #' \item{`commission_review_date_target`}{Target Planning Commission review date} #' \item{`implementation_status`}{Plan implementation status} +#' \item{`program_numbers`}{School program numbers} #' \item{`planning_districts`}{Planning Districts} #' \item{`neighborhoods`}{Neighborhoods} #' \item{`council_districts`}{Baltimore City Council Districts} diff --git a/data-raw/inspire_plans.R b/data-raw/inspire_plans.R index e14554b..f30fa70 100644 --- a/data-raw/inspire_plans.R +++ b/data-raw/inspire_plans.R @@ -3,105 +3,73 @@ library(mapbaltimore) library(sfext) library(getdata) -inspire_path <- - "https://geodata.baltimorecity.gov/egis/rest/services/Planning/Boundaries/MapServer/19" +inspire_path <- "https://geodata.baltimorecity.gov/egis/rest/services/Planning/Boundaries/MapServer/19" -inspire_xwalk <- - tibble::tribble( - ~OBJECTID, ~PRG_NUM, ~School_1, ~plan_name, - 29L, 406L, "Forest Park High", "Forest Park High School and Calvin Rodwell Elementary School INSPIRE", - 30L, 256L, "Calvin M. Rodwell Elementary", "Forest Park High School and Calvin Rodwell Elementary School INSPIRE", - 31L, 213L, "Govans Elementary", "Govans Elementary School INSPIRE", - 32L, 249L, "Medfield Heights Elementary", "Medfield Heights Elementary School INSPIRE", - 33L, 37L, "Harford Heights Elementary and Sharp-Leadenhall", "REACH! Partnership at Lake Clifton Park + Harford Heights Building INSPIRE", - 34L, 85L, "Fort Worthington Elementary", "Fort Worthington Elementary/Middle School INSPIRE", - 35L, 204L, "Mary E. Rodman Elementary", "Mary E. Rodman Elementary School INSPIRE", - 36L, 88L, "Lyndhurst Elementary", "Wildwood (Lyndhurst) Elementary/Middle School INSPIRE", - 37L, 247L, "Cross Country Elementary/Middle", "Cross Country Elementary/Middle School INSPIRE", - 38L, 223L, "Pimlico Elementary/Middle", "Pimlico Elementary/Middle School INSPIRE", - 39L, 234L, "Arlington Elementary/Middle", "Arlington Elementary School INSPIRE", - 40L, 134L, "Walter P. Carter Elementary/Middle School and Lois T. Murray", "Walter P. Carter and Lois T. Murray Elementary/Middle Schools INSPIRE", - 41L, 242L, "Northwood Elementary", "Northwood Elementary School INSPIRE", - 42L, 366L, "Baltimore Antioch Diploma Plus High School", "REACH! Partnership at Lake Clifton Park + Harford Heights Building INSPIRE", - 43L, 44L, "Montebello Elementary/Middle", "Montebello Elementary/Middle School INSPIRE", - 44L, 338L, "Highlandtown Elementary/Middle #237", "Highlandtown Elementary/Middle School #237 INSPIRE", - 45L, 228L, "John Ruhrah Elementary/Middle", "John Ruhrah Elementary/Middle School INSPIRE", - 46L, 405L, "Patterson High School and Claremont", "Patterson High School and Claremont Middle/High School Planning Area INSPIRE", - 47L, 427L, "Academy for College and Career Exploration and Independence School", "Robert Poole Building INSPIRE", - 48L, 142L, "Robert W. Coleman Elementary", "Robert W. Coleman Elementary School INSPIRE", - 49L, 61L, "John Eager Howard Elementary", "Dorothy I. Height (John Eager Howard) Elementary School INSPIRE", - 50L, 75L, "Calverton", "Billie Holiday (James Mosher) Elementary School + Katherine Johnson Global Academy (Calverton Elementary/Middle) INSPIRE", - 51L, 144L, "James Mosher Elementary", "Billie Holiday (James Mosher) Elementary School + Katherine Johnson Global Academy (Calverton Elementary/Middle) INSPIRE", - 52L, 260L, "Frederick Elementary", "Frederick Elementary School INSPIRE", - 53L, 124L, "Bay-Brook Elementary/Middle", "Bay Brook Elementary/Middle School INSPIRE", - 54L, 159L, "Cherry Hill Elementary/Middle", "Arundel Elementary and Cherry Hill Elementary/Middle Schools INSPIRE", - 55L, 164L, "Arundel Elementary/Middle", "Arundel Elementary and Cherry Hill Elementary/Middle Schools INSPIRE", - 56L, 27L, "Friendship Academy of Science and Technology", "Commodore John Rodgers Elementary/Middle School INSPIRE" - ) +inspire_path <- "https://services1.arcgis.com/43Lm3JYE3nM91DAF/ArcGIS/rest/services/INSPIRE_Planning_Areas/FeatureServer/0" -inspire <- +inspire_source <- sfext::read_sf_ext(url = inspire_path) %>% sfext::rename_sf_col() %>% - left_join(inspire_xwalk) %>% sf::st_transform(2804) -baybrook <- inspire %>% - filter(plan_name == "Bay Brook Elementary/Middle School INSPIRE") %>% +baybrook <- inspire_source %>% + dplyr::filter(plan_name == "Bay Brook Elementary/Middle School INSPIRE") %>% + dplyr::mutate( + plan_name_short = "Bay Brook EMS" + ) |> st_buffer_ext( dist = .25, unit = "mi" ) %>% - select(plan_name) + select(plan_name_short) -inspire_addon <- - get_location( - bcpss::bcps_programs_SY2021, - name = c("Frederick Douglass H", "The Reach! H", "Ft Worthington EM"), - name_col = "program_name_short" - ) %>% - sf::st_transform(2804) %>% +douglass <- get_location( + bcpss::bcps_programs_SY2021, + name = c("Frederick Douglass H"), + name_col = "program_name_short", + crs = 2804 +) |> st_buffer_ext( - dist = 0.25, + dist = .25, unit = "mi" - ) %>% - mutate( - plan_name = dplyr::case_when( - program_name_short == "Frederick Douglass H" ~ "Robert W. Coleman Elementary School INSPIRE", - program_name_short == "The Reach! H" ~ "REACH! Partnership at Lake Clifton Park + Harford Heights Building INSPIRE", - program_name_short == "Ft Worthington EM" ~ "Fort Worthington Elementary/Middle School INSPIRE" - ) - ) %>% - bind_rows(baybrook) - -inspire_union <- inspire %>% - dplyr::filter(!(PRG_NUM %in% c(366, 85, 124))) %>% - bind_rows(inspire_addon) %>% - group_by( - plan_name - ) %>% - summarise( - geometry = sf::st_combine(sf::st_union(geometry)) ) -plans <- - getdata::get_airtable_data( - base = "appZPNXZR398hkvm9", - table = "tbljHGkeDOlS1MlUi", - view = "viw1SWsKcrnvqoMpq", # Public view - cell_format = "string", - geometry = FALSE +coleman <- inspire_source |> + dplyr::filter( + plan_name_short == "Robert Coleman ES" + ) |> + mutate( + geometry = sf::st_union(geometry, douglass$geometry) ) -inspire_union_map <- - inspire_union %>% - left_join(plans, by = "plan_name") %>% - relocate_sf_col() +plans_geometry <- inspire_source |> + dplyr::filter(!(plan_name_short %in% c("Robert Coleman ES", "Bay Brook EMS"))) |> + dplyr::bind_rows( + coleman, + baybrook + ) |> + dplyr::select(plan_name_short) -inspire_plans <- inspire_union_map %>% - # st_join_ext( - # list("planning_district" = planning_districts, - # "legislative_district" = legislative_districts), - # largest = TRUE) %>% +plans_source <- rairtable::list_records( + base = "appZPNXZR398hkvm9", + table = "tbljHGkeDOlS1MlUi", + view = "viw1SWsKcrnvqoMpq", # Public view + cell_format = "string" +) + +plans <- plans_source |> + janitor::clean_names() |> + dplyr::left_join( + plans_geometry, + by = dplyr::join_by(plan_name_short) + ) |> + sf::st_as_sf() + +inspire_plans <- plans %>% + mutate( + program_numbers = stringr::str_remove(program_numbers, pattern = "[:space:]"), + program_numbers = stringr::str_split(program_numbers, pattern = ",") + ) |> select( plan_name, plan_name_short, @@ -121,6 +89,7 @@ inspire_plans <- inspire_union_map %>% recommendations_date_target, commission_review_date_target, implementation_status, + program_numbers, planning_districts, neighborhoods, council_districts diff --git a/data/inspire_plans.rda b/data/inspire_plans.rda index 8a2fb0f..e92cc5f 100644 Binary files a/data/inspire_plans.rda and b/data/inspire_plans.rda differ diff --git a/man/inspire_plans.Rd b/man/inspire_plans.Rd index 08b3410..73cd102 100644 --- a/man/inspire_plans.Rd +++ b/man/inspire_plans.Rd @@ -5,7 +5,7 @@ \alias{inspire_plans} \title{INSPIRE Plans} \format{ -A data frame with 24 rows and 19 variables: +A data frame with 24 rows and 23 variables: \describe{ \item{\code{plan_name}}{Plan name} \item{\code{plan_name_short}}{Plan name (short)} @@ -25,6 +25,7 @@ A data frame with 24 rows and 19 variables: \item{\code{recommendations_date_target}}{Target draft recommendation report publication date} \item{\code{commission_review_date_target}}{Target Planning Commission review date} \item{\code{implementation_status}}{Plan implementation status} +\item{\code{program_numbers}}{School program numbers} \item{\code{planning_districts}}{Planning Districts} \item{\code{neighborhoods}}{Neighborhoods} \item{\code{council_districts}}{Baltimore City Council Districts} @@ -37,4 +38,7 @@ inspire_plans \description{ Data frame and boundary geometry for INSPIRE Plans adopted and in progress. } +\details{ +Last updated: 2024-03-29 +} \keyword{datasets}