-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
140 lines (96 loc) · 5.09 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
---
title: "SiteSelection"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
**SiteSelection** aims to find complex zones to reallocate street space in the city, characterized by having limited and disputed spaces. These zones are also areas that have the potential for reallocating space dynamically over time, especially when multimodal demands are complementary.
It consists in a process of multi criteria to select the cell locations of a given city or neighbourhood where the street space is more disputed by different transport modes and street activities.
SiteSelection is a full script that uses a dynamic pipeline, and gathers and processes information on:
* Road network centrality measures (betweenness, closeness, degree)
* Population density
* POI and activities
* Public Transit Frequency
* Traffic levels (_TBC_)
## Sources
The SiteSelection package is based in Portuguese open datasets, such as census and GTFS data.
Although it is easy to run for any location in Portugal, you may adapt the code to run at other locations (considering you have the similar data needed).
Data needed for other locations:
* Census data (population and buildings)
* POIs (see [data_extract.R](https://github.com/U-Shift/SiteSelection/blob/fc0bce07acf3b60ce0bfe1d26511acd7c2d5c083/code/data_extract.R#L146))
* GTFS data (see [transit.R](https://github.com/U-Shift/SiteSelection/blob/main/code/transit.R))
* Administrative boundaries
## Setup
### Installation
```{r eval=FALSE}
# install.packages("devtools")
devtools::install_github("u-shift/SiteSelection")
```
### Requirements
* QGis and [`qgis_process`](https://r-spatial.github.io/qgisprocess/) installed and working
* [`targets`](https://books.ropensci.org/targets/) R package.
* [`siteselection`]() R package [_under development_].
### Change defaults
Open the `_targets.R` file and change the defaults to your needs (don't forget to save the file before run!):
```{r eval=FALSE}
# Set defaults HERE ######################
CITY_input = "Almada" # Municipality name in Portugal
GEOJSON = TRUE # use a different limit? made with https://geojson.io/ and saved in inputdata/*.geojson
GEOJSON_input = "map1" # name of the file if GEOJSON = TRUE. default: "map1"
cellsize_input = c(400, 400)# in meters
square_input = TRUE # TRUE = squares, FALSE = hexagons
build_osm = FALSE # build and clean osm road network again?
analysis = FALSE # export input parameters and results to a xls file? default: FALSE
# Thresholds
population_min = median # mean or median? default: mean
degree_min = mean # mean or median? default: mean
betweeness_range = 0.40 # percentile to exclude (upper and lower) default: 0.25
closeness_range = 0.25 # value to exclude (upper and lower) default: 0.25
entropy_min = 0.35 # value to exclude (lower) default: 0.5
freq_bus = c(4, 10, 20) # frequency of bus stops to define classification. last 2 will remain. default: c(4, 10, 20)
```
### Run the pipeline
```{r eval=FALSE}
library(targets)
tar_visnetwork(targets_only = TRUE) # or false, to show objects
```
And you should have something like this
```{r echo=FALSE}
# requires targets
knitr::include_graphics("man/figures/tar_viz_run.png")
```
```{r eval=FALSE}
tar_make()
# let it run
tar_load(grid_all)
mapview::mapview(grid_all, zcol="score") #ranked cells
```
```{r echo=FALSE}
knitr::include_graphics("man/figures/tar_result.png")
```
If you want to see the filtered cells (candidates), you can load the `site_selection` object and plot it, with *complex* and *very complex* cells (transit layer considered).
```{r echo=FALSE}
knitr::include_graphics("man/figures/complexity.png")
```
When the process is not complete, you may have an error like this
```{r eval=FALSE}
tar_visnetwork()
```
```{r echo=FALSE}
knitr::include_graphics("man/figures/tar_viz_werror.png")
```
### Work with non-administrative boundary
You can set another polygon limit to the analysis.
Just [create a .geojson file](https://geojson.io/) with the area of interest and save it in the `inputdata` folder.
Then, set the `GEOJSON = TRUE` and `GEOJSON_input` to the name of the file, without the extension.
### Analysis
If you want to analyze the results in detail, set `analysis = TRUE` in `_targets.R` and load the analysis/analysis.table.Rds or .xlsx.
It includes sequential runs with all inputs, outputs, and variable statistics.
_Work in Progress..._
## About
This work is part of [Streets4All Project](https://streets4all.tecnico.ulisboa.pt), developed at the University of Lisbon and at the University of Coimbra, and funded by Fundação para a Ciência e Tecnologia (PT).
The concept is based in:
Valença, G., Moura, F., & Morais de Sá, A. (2023). Where is it complex to reallocate road space? *Environment and Planning B: Urban Analytics and City Science*, 0(0). https://doi.org/10.1177/23998083231217770.
Please refer to this work as:
Félix R, Valença G (2024). *SiteSelection: An R script to find complex areas for the Streets4All Project*. R package version 0.2, https://github.com/U-Shift/SiteSelection/.