-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
207 lines (127 loc) · 11.7 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# home2park <a href='https://ecological-cities.github.io/home2park/'><img src='man/figures/logo.png' align="right" height="139" /></a>
<!-- badges: start -->
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![R-CMD-check](https://github.com/ecological-cities/home2park/workflows/R-CMD-check/badge.svg)](https://github.com/ecological-cities/home2park/actions)
[![test-coverage](https://github.com/ecological-cities/home2park/workflows/test-coverage/badge.svg)](https://github.com/ecological-cities/home2park/actions)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.03609/status.svg)](https://doi.org/10.21105/joss.03609)
<!-- badges: end -->
## Spatial Provision of Urban Parks
Assess the spatial provision of urban parks to residential buildings city-wide. Refer to [package website](https://ecological-cities.github.io/home2park/) for demonstrations of how the package may be used.
## Installation
Install the development version of `home2park` from GitHub:
```{r, eval = FALSE}
devtools::install_github("ecological-cities/home2park", ref = "main")
```
## Setup
Load the package:
```{r eval = FALSE}
library(home2park)
```
```{r include = FALSE, eval = TRUE}
devtools::load_all() # to knit manually w latest changes (not built/installed yet)
```
## Citation
To cite `home2park` or acknowledge its use, please cite the following:
*Song, X. P., Chong, K. Y. (2021). home2park: An R package to assess the spatial provision of urban parks. Journal of Open Source Software, 6(65), 3609. https://doi.org/10.21105/joss.03609*
<br>
To get a BibTex entry, run `citation("home2park")`.
<br>
## Background
Parks are important spaces for recreation and leisure in cities. Conventional measures of park provision tend to rely on summaries of park area within a given region (e.g. per capita park area). However, there is a need to characterise the wide variety of parks (e.g. nature areas, gardens, waterfront parks, outdoor playgrounds, etc.) that serve different groups of people. When planning at fine spatial scales, such current metrics are also limited by their coarse spatial resolution and the presence of artificial boundaries.
<br>
## Using home2park
The package `home2park` provides a way to measure _multiple aspects_ of park provision to homes, at the resolution of _individual buildings_. The key features include the ability to:
- Download relevant data from OpenStreetMap (OSM) such as buildings, parks and features related to recreation. The user may also supply data for new buildings and parks, for the purpose of future scenario planning.
- Redistribute coarse-scale population data per census unit into residential buildings, also known as ‘dasymetric mapping’, which helps highlight specific areas where more people will benefit from the presence of parks.
- Summarise at each park multiple attributes that are important for recreation (e.g. dense vegetation, length of waterfronts, open spaces, trails, etc.).
- Calculate the supply (provision) of the park attributes to each residential building, while accounting for 'distance decay', or the fact that supply from parks further away are reduced.
The following sections provide a high-level overview of the various steps required to measure the spatial provision of parks. Further details and code examples can be found in the package vignette '[Get started](https://ecological-cities.github.io/home2park/articles/home2park.html)'.
### 1. Process city population
Residential buildings (homes) are an important component of the analysis. These may be obtained, for example, by downloading building polygons from OpenStreetMap (OSM), and subsetting the dataset to areas within 'residential' land use zones.
In addition, having the population count per residential building allows us to calculate the total spatial provision of parks to all residents, and can help highlight important areas where more people will benefit from the presence of parks. Coarse-scale population census data can be redistributed into the residential buildings, via a technique known as 'dasymetric mapping'. The number of building 'levels' from OSM can be used as a proxy for population density (i.e. more residents per unit area). Here's an example screenshot showing an overlay of multiple example datasets in the package (for the city of Singapore), which were used to redistribute population data per census unit (subzones) across residential buildings.
```{r, echo=FALSE, fig.align = "center", out.width="80%", fig.cap = paste0("Example screenshot showing an overlay of multiple datasets used to redistribute the population across buildings within residential land use zones. The legends are ordered (top to bottom) by increasing spatial resolution.")}
knitr::include_graphics("man/figures/README-dasymetric-mapping.png")
```
<br>
Residential building polygons in Singapore each with a population count can be found in the following example dataset:
```{r}
data(buildings_pop_sgp)
head(buildings_pop_sgp)
```
<br>
### 2. Process parks
Parks are the other important component of the analysis. These may be downloaded from OSM and processed using this package. The following example dataset contains parks in Singapore with selected attributes related to recreation/leisure:
```{r}
data(parks_sgp)
head(parks_sgp[, 28:33]) # subset to relevant columns
```
<br>
### 3. Recreation supply
With the processed building and park polygons, the provision of park attributes per residential building can be calculated. The total supply $S$ of each park attribute to a building is calculated based on the following equation. Its value depends on the distances between that particular building and all parks; attributes from parks further away are reduced as a result of the negative exponential function _e<sup>-cd</sup>_, an effect also known as the 'distance decay' ([Rossi et al., 2015](http://dx.doi.org/10.1016/j.apgeog.2015.06.008)).
```{r, echo=FALSE, fig.align = "center", out.width="18%"}
knitr::include_graphics("man/figures/README-equation.png")
```
where
- $S$ = Total supply of a specific park attribute to the building from parks $i$; $i$ = 1,2,3, ... $n$ where $n$ = total number of parks citywide.
- $s_{i}$ = Supply of a specific park attribute from park $i$. A perfect positive linear association is assumed, since the focus is on supply metrics.
- $d_{i}$ = Distance in kilometres from the building to park $i$ (e.g. Euclidean, Manhattan, etc.).
- $c$ = Coefficient determining rate of decay in supply $s_{i}$ with increasing distance.
<br>
Note that the value of Coefficient $c$ depends on both park and park visitors' attributes, such as socio-demographic factors and preferences for activities that may impel shorter or longer travel ([Rossi et al., 2015](http://dx.doi.org/10.1016/j.apgeog.2015.06.008); [Tu et al.](https://doi.org/10.1016/j.ufug.2020.126689)). A lower value implies that parks further away are accessible or frequently visited by residents (i.e. still contributes to the 'recreation supply' of a particular building).
```{r, echo=FALSE, fig.align = "center", out.width="50%", fig.cap = paste0("Figure: The value of Coefficient c and its effect on the distance decay between a building and park.")}
knitr::include_graphics("man/figures/README-c-sensitivity.png")
```
<br>
```{r, echo=FALSE, fig.align = "center", out.width="100%", fig.cap = paste0("Screenshot: Examples showing the supply of OSM park area to residential buildings in Singapore for the year 2020 when the value of Coefficient c is 0.1 (left panel) and 1 (right panel). Each building is denoted as a pount (a random subset is shown). The color palette for the buildings (points) is binned according to quantile values.")}
knitr::include_graphics("man/figures/README-c-sensitivity-map.png")
```
<br>
To calculate the supply of each park attribute, we first calculate the pairwise distances between all buildings and parks (a distance matrix). This output is supplied to the function `recre_supply()`. For example, we can calculate the supply of park _area_ to each building. This supply value can then be multiplied by the population count per building, to obtain the total supply to all residents.
```{r calc distance matrix and supply of park area, message = FALSE, warning = FALSE}
# transform buildings & parks to projected crs
buildings_pop_sgp <- sf::st_transform(buildings_pop_sgp, sf::st_crs(32648))
parks_sgp <- sf::st_transform(parks_sgp, sf::st_crs(32648))
# convert buildings to points (centroids), then calculate distances to every park
m_dist <- buildings_pop_sgp %>%
sf::st_centroid() %>%
sf::st_distance(parks_sgp) %>% # euclidean distance
units::set_units(NULL)
m_dist <- m_dist / 1000 # convert distances to km
# new column for the supply of park area
buildings_pop_sgp$area_supply <- recre_supply(park_attribute = parks_sgp$area,
dist_matrix = m_dist,
c = 0.302) # e.g. from Tu et al. (2020)
# supply to all residents per building
buildings_pop_sgp$area_supplytopop <- buildings_pop_sgp$area_supply * buildings_pop_sgp$popcount
```
```{r, echo=FALSE, fig.align = "center", out.width="100%", fig.cap = paste0("Screenshot: Supply of park area to building residents in Singapore based on OSM data (2020). Each building is denoted as a point (a random subset is shown). The value for Coefficient c was set at 0.302. The color palette is binned according to quantile values.")}
knitr::include_graphics("man/figures/README-supply-parkarea-to-building-residents.png")
```
```{r include = FALSE}
rm(buildings_pop_sgp, parks_sgp, pop_sgp,
m_dist)
```
<br>
## Data sources
- Singapore census data from the [Department of Statistics Singapore](https://www.singstat.gov.sg/find-data/search-by-theme/population/geographic-distribution/latest-data). Released under the terms of the [Singapore Open Data Licence version 1.0](https://data.gov.sg/open-data-licence).
- Singapore subzone polygons from the [Singapore Master Plan Subzones](https://data.gov.sg/dataset/master-plan-2019-subzone-boundary-no-sea). Released under the terms of the [Singapore Open Data Licence version 1.0](https://data.gov.sg/open-data-licence).
- Singapore Master Plan Land Use Zones for the years [2014](https://data.gov.sg/dataset/master-plan-2014-land-use) and [2019](https://data.gov.sg/dataset/master-plan-2019-land-use-layer). Released under the terms of the [Singapore Open Data License](https://data.gov.sg/open-data-licence).
- Building polygons derived from map data [copyrighted](https://www.openstreetmap.org/copyright) OpenStreetMap contributors and available from https://www.openstreetmap.org. Released under the terms of the [ODbL License](https://opendatacommons.org/licenses/odbl/summary/).
- Park polygons and summarised attributes (trails, playgrounds) derived from map data [copyrighted](https://www.openstreetmap.org/copyright) OpenStreetMap contributors and available from https://www.openstreetmap.org. Released under the terms of the [ODbL License](https://opendatacommons.org/licenses/odbl/summary/).
<br>
## References
Rossi, S. D., Byrne, J. A., & Pickering, C. M. (2015). The role of distance in peri-urban national park use: Who visits them and how far do they travel?. _Applied Geography_, 63, 77-88.
Tu, X., Huang, G., Wu, J., & Guo, X. (2020). How do travel distance and park size influence urban park visits?. _Urban Forestry & Urban Greening_, 52, 126689.