Skip to content

Commit

Permalink
Add docs for ndc_projects
Browse files Browse the repository at this point in the history
Also update data for `baltimore_mihp`
  • Loading branch information
elipousson committed Nov 28, 2024
1 parent 9cf953d commit c2d741d
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 25 deletions.
29 changes: 28 additions & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@
#' Trust](https://mht.maryland.gov/), Maryland's statewide historic preservation
#' office and an agency within the Maryland Department of Planning. The
#' boundaries represent property boundaries and district boundaries depending on
#' the type of MIHP record. Updated 2024 October 29.
#' the type of MIHP record. Updated 2024 November 27.
#'
#' @format A data frame with 5,231 rows and 14 variables:
#' \describe{
Expand Down Expand Up @@ -1231,3 +1231,30 @@
#' }
#' @details Created using the [getACS::make_area_xwalk()] data.
"baltimore_census_xwalk"

#' Neighborhood Design Center Projects
#'
#' @keywords internal
#' @description A reference to project completed by the Neighborhood Design
#' Center through 2022.
#' @format A data frame with 2487 rows and 16 variables:
#' \describe{
#' \item{\code{ndc_office}}{character NDC Office}
#' \item{\code{ndc_program}}{character NDC Program}
#' \item{\code{project_id}}{double Project ID}
#' \item{\code{project_name}}{character Project name}
#' \item{\code{project_type}}{character Project type}
#' \item{\code{project_status}}{character Project status}
#' \item{\code{start_date}}{character Start date}
#' \item{\code{end_date}}{character End date}
#' \item{\code{client_name}}{character Client name}
#' \item{\code{address}}{character Street address}
#' \item{\code{city}}{character City}
#' \item{\code{state}}{character State}
#' \item{\code{zip_code}}{integer Zip code}
#' \item{\code{geometry}}{list Geometry}
#' \item{\code{start_year}}{character Start year}
#' \item{\code{end_year}}{character End year}
#'}
#' @details DETAILS
"ndc_projects"
67 changes: 44 additions & 23 deletions data-raw/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ county_name <- "Baltimore City"
# Set projected CRS (NAD83(HARN) / Maryland, meters)
selected_crs <- 2804

# https://github.com/r-spatial/sf/issues/1341#issuecomment-1120284345
escape_crs <- function(x) {
sf::st_crs(x)$wkt <- gsub(
"°|º", "\\\u00b0",
sf::st_crs(x)$wkt
)

x
}

# Nested CSAs are used to download larger datasets in portions
csas_nest <- csas %>%
dplyr::nest_by(name)
Expand Down Expand Up @@ -172,25 +182,34 @@ congressional_districts <- md_congressional_districts %>%

usethis::use_data(congressional_districts, overwrite = TRUE)

planning_districts_path <- "https://geodata.baltimorecity.gov/egis/rest/services/Housing/dmxBoundaries3/MapServer/9"
planning_districts <- esri2sf::esri2sf(planning_districts_path) %>%
sf::st_transform(selected_crs) %>%
janitor::clean_names("snake") %>%
dplyr::mutate(
name = paste0(area_name, " Planning District")
) %>%
dplyr::select(
id = area_name,
name,
abb = area_abbr,
geometry = geoms
) %>%
dplyr::arrange(id)
load_baltimore_planning_districts <- function(
url = "https://geodata.baltimorecity.gov/egis/rest/services/Housing/dmxBoundaries3/MapServer/11",
crs = 2804,
...
) {
arcgislayers::arc_read(
url = url,
crs = crs
) |>
sf::st_make_valid() |>
janitor::clean_names("snake") |>
dplyr::mutate(
name = paste0(area_name, " Planning District")
) |>
dplyr::select(
id = area_name,
name,
abb = area_abbr
) |>
dplyr::arrange(id) |>
sf::st_cast("MULTIPOLYGON")
}


planning_districts <- planning_districts %>%
sf::st_make_valid() %>%
st_trim(mapbaltimore::baltimore_city) %>%
sf::st_cast("MULTIPOLYGON")
planning_districts <- load_baltimore_planning_districts()

# planning_districts <- planning_districts |>
# sfext::st_trim(mapbaltimore::baltimore_city)# %>%

usethis::use_data(planning_districts, overwrite = TRUE)

Expand Down Expand Up @@ -350,10 +369,10 @@ csas_path <- "https://services1.arcgis.com/mVFRs7NF4iFitgbY/arcgis/rest/services
csas <- esri2sf::esri2sf(csas_path) %>%
sf::st_transform(selected_crs) %>%
janitor::clean_names("snake") %>%
dplyr::mutate(
neigh = strsplit(neigh, ","),
tracts = strsplit(tracts, ","),
) %>%
# dplyr::mutate(
# neigh = strsplit(neigh, ","),
# tracts = strsplit(tracts, ","),
# ) %>%
dplyr::select(
id = fid,
name = community,
Expand Down Expand Up @@ -824,7 +843,6 @@ osm_xwalk <- tibble::tribble(
"1640 Light St.", "way/964597342"
)


parks_final <- parks %>%
left_join(osm_parks_name_matched, by = "name") %>%
left_join(osm_xwalk, by = "name") %>%
Expand Down Expand Up @@ -965,6 +983,9 @@ get_mihp <- function(

baltimore_mihp <- get_mihp()

baltimore_mihp <- baltimore_mihp |>
escape_crs()

usethis::use_data(baltimore_mihp, overwrite = TRUE)


Expand Down
Binary file modified data/baltimore_mihp.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/baltimore_mihp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions man/ndc_projects.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c2d741d

Please sign in to comment.