Skip to content

Commit

Permalink
feat: update baltimore_gis_index + add get_neighborhood
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed May 26, 2023
1 parent 94d655c commit 4987eef
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 44 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export(get_data_batch)
export(get_intersection)
export(get_maryland_open_resource)
export(get_nearby_areas)
export(get_neighborhood)
export(get_streets)
export(layer_area_data)
export(layer_area_mask)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# mapbaltimore development

* Add new `buildings_21stc` data (2023-04-28).
* Update `baltimore_gis_index` data (2023-05-26).
* Add `get_neighborhood()` and refactor `get_baltimore_area()` for more consistency with `{getdata}` parameter names (2023-05-26).

# mapbaltimore 0.1.1.9000 (2023-03-31)

Expand Down
4 changes: 2 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,9 @@
#' Servers maintained by the Baltimore City Mayor's Office of Information
#' Technology (MOIT) Enterprise GIS (EGIS) program. A limited number of
#' potential sensitive and unresponsive server layers have been excluded. Used
#' by the [get_baltimore_esri_data()] function. Updated December 23, 2022.
#' by the [get_baltimore_esri_data()] function. Updated 2023 May 26.
#'
#' @format A data frame with 1,286 rows and 17 variables:
#' @format A data frame with 1,324 rows and 17 variables:
#' \describe{
#' \item{`name`}{Name}
#' \item{`nm`}{Name with snake case}
Expand Down
47 changes: 26 additions & 21 deletions R/get_area.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#' (not supported by all data sets), or location (as an address or sf object).
#' Name and id are not supported for U.S. Census geogrpahies. Use the location
#' parameter to return any areas of the selected type that intersect with the
#' specified location. [get_baltimore_area()] is identical and recommended over
#' specified location. [get_baltimore_area()] has different parameter names
#' (more consistent with [getdata::get_location()]) and is now recommended over
#' [get_area()] to avoid a name conflict with the [sfext::get_area()] function.
#'
#' @param type Required. Area type matching one of the boundary datasets
Expand Down Expand Up @@ -60,11 +61,11 @@ get_area <- function(type = c(
location = NULL,
union = FALSE,
area_label = NULL) {
type <- type %||% "neighborhood"
rlang::check_required(type)
if (stringr::str_detect(type, "s$")) {
type <- stringr::str_remove(type, "s$")
}

type <- arg_match(type)

area_source <-
Expand Down Expand Up @@ -102,30 +103,34 @@ get_area <- function(type = c(
#' @name get_baltimore_area
#' @export
get_baltimore_area <- function(
type = c(
"neighborhood",
"council district",
"legislative district",
"congressional district",
"planning district",
"police district",
"csa",
"park district",
"block",
"block group",
"tract"
),
area_name = NULL,
area_id = NULL,
type = NULL,
name = NULL,
id = NULL,
location = NULL,
union = FALSE,
area_label = NULL) {
label = NULL) {
get_area(
type = type,
area_name = area_name,
area_id = area_id,
area_name = name,
area_id = id,
location = location,
union = union,
area_label = label
)
}

#' @rdname get_area
#' @name get_neighborhood
#' @export
get_neighborhood <- function(name,
location = NULL,
union = FALSE,
...) {
get_area(
type = "neighborhood",
area_name = name,
location = location,
union = union,
area_label = area_label
...
)
}
34 changes: 22 additions & 12 deletions data-raw/baltimore_gis_index.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## code to prepare `baltimore_arcgis_index` dataset goes here
library(dplyr)
library(glue)

clean_esriIndex <- function(x) {
x %>%
Expand Down Expand Up @@ -47,20 +48,29 @@ egis_gis_index <-
egis_gis_index <-
clean_esriIndex(egis_gis_index)

open_baltimore_index <-
esri2sf::esriIndex(
url = "https://opendata.baltimorecity.gov/egis/rest/services/OpenBaltimore",
recurse = TRUE
)

hosted_index <-
esri2sf::esriIndex(
url = "https://opendata.baltimorecity.gov/egis/rest/services/Hosted",
recurse = TRUE
)

nonspatial_index <-
esri2sf::esriIndex(
url = "https://opendata.baltimorecity.gov/egis/rest/services/NonSpatialTables/",
recurse = TRUE
)

opendata_gis_index <-
bind_rows(
esri2sf::esriIndex(
url = "https://opendata.baltimorecity.gov/egis/rest/services/Hosted",
recurse = TRUE
),
esri2sf::esriIndex(
url = "https://opendata.baltimorecity.gov/egis/rest/services/NonSpatialTables",
recurse = TRUE
),
esri2sf::esriIndex(
url = "https://opendata.baltimorecity.gov/egis/rest/services/OpenBaltimore",
recurse = TRUE
)
hosted_index,
nonspatial_index,
open_baltimore_index
)

opendata_gis_index <-
Expand Down
Binary file modified data/baltimore_gis_index.rda
Binary file not shown.
4 changes: 2 additions & 2 deletions man/baltimore_gis_index.Rd

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

16 changes: 9 additions & 7 deletions man/get_area.Rd

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

0 comments on commit 4987eef

Please sign in to comment.