An open API service indexing awesome lists of open source software.

https://github.com/elipousson/birdseyeview

πŸ¦‰πŸ—ΊοΈ A R package for making community planning maps.
https://github.com/elipousson/birdseyeview

r-package rspatial rstats urban-planning

Last synced: 4 months ago
JSON representation

πŸ¦‰πŸ—ΊοΈ A R package for making community planning maps.

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# birdseyeview

[![CRAN status](https://www.r-pkg.org/badges/version/birdseyeview)](https://CRAN.R-project.org/package=birdseyeview)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)

The goal of birdseyeview is to make it easy to create the types of maps, plots, and tables used for community plans.

This package was initially designed to use the [overedge package](https://elipousson.github.io/overedge/) and data packages like [mapbaltimore](https://elipousson.github.io/mapbaltimore/) or [bcpss](https://elipousson.github.io/bcpss/) to create reproducible maps and tables for a range of needs. The {overedge} package has since been superseded by sfext, getdata, and maplayer. maplayer incorporated most of the mapping functions creating for birdseyeview. These duplicative functions were removed from birdseyeview in Setember 2022.

## Installation

You can install the development version of birdseyeview like so:

``` r
remotes::install_github("elipousson/birdseyeview")
```

## Example

```{r setup}
library(birdseyeview)
library(getdata)
library(sfext)
library(maplayer)
```

### Make tables

```{r gt_sf_rows}
parks <-
getdata::get_location_data(
data = "parks",
package = "mapbaltimore"
)

parks %>%
dplyr::slice_head(n = 4) %>%
dplyr:::select(name, address, park_district, acres, geometry) %>%
dplyr::group_by(park_district) %>%
gt::gt() %>%
gt_sf_rows(fill = "forestgreen", color = "lightgreen", size = 6)
```

```{r tbl_photo_key, eval = FALSE}
park_photos <-
getdata::get_flickr_photos(
user_id = "baltimoreheritage",
tags = "druidhillpark",
img_size = "m",
sort = "date-posted",
per_page = 20
)

park_photos[1:6, ] %>%
dplyr::select(title, datetaken, image_height, image_width, image_url) %>%
tbl_photo_key(photo_col = "image_url", orientation = "landscape", number = TRUE)
```

### Make maps

```{r}
library(ggplot2)
```

```{r layer_show_context}
ggplot() +
maplayer::layer_location_context(
data = parks[245, ],
fill = "green",
context = parks,
context_params = list(fill = "forestgreen", color = "gray60", alpha = 1)
)
```

```{r make_group_layers, eval=FALSE}
# make_group_layers has been dropped from birdseyeview but isn't available in maplayer yet
park_district_layers <-
make_group_layers(
data = parks %>% sf::st_centroid(),
mapping = aes(color = name),
groupname_col = "park_district"
)

clifton_district <-
getdata::get_location(
type = "park_districts",
package = "mapbaltimore",
name = "Clifton"
)

ggplot() +
park_district_layers[[1]] +
guides(color = "none") +
layer_show_location(
data = clifton_district
) +
theme_void()
```