FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
open_data/GM_Accessibility_Levels/script.R at master · traffordDataLab/open_data · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
traffordDataLab
/
open_data
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
3
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
open_data
/
GM_Accessibility_Levels
/
script.R
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (36 loc) · 1.64 KB
Breadcrumbs
open_data
/
GM_Accessibility_Levels
/
script.R
Copy path
File metadata and controls
44 lines (36 loc) · 1.64 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
# Greater Manchester Accessibility Levels ##
#
Source: Transport for Greater Manchester
#
Publisher URL: https://data.gov.uk/dataset/d9dfbf0a-3cd7-4b12-a39f-0ec717423ee4/gm-accessibility-levels-gmal
#
Licence: Open Government Licence
#
Data: 2023-08-30
#
Last updated: 2023-09-27
#
load libraries ---------------------------
library(
tidyverse
) ; library(
sf
)
#
load data ---------------------------
url
<-
"
http://odata.tfgm.com/opendata/downloads/GMAL/GMAL_TfGMOpenData.zip
"
download.file(
url
,
dest
=
"
GMAL_TfGMOpenData.zip
"
)
unzip(
"
GMAL_TfGMOpenData.zip
"
)
file.remove(
"
GMAL_TfGMOpenData.zip
"
)
raw
<-
st_read(
"
SHP-format/GMAL_grid_open.shp
"
) %
>
% st_transform(
crs
=
4326
)
bdy
<-
st_read(
"
https://www.traffordDataLab.io/spatial_data/local_authority/2021/gm_local_authority_full_resolution.geojson
"
)
#
tidy data ---------------------------
sf
<-
st_intersection(
raw
,
bdy
) %
>
%
select(
`GMAL level`
=
GMALLevel
,
`GMAL score`
=
GMALScore
,
`Area code`
=
area_code
,
`Area name`
=
area_name
)
#
style GeoJSON ---------------------------
sf
<-
sf
%
>
%
mutate(
stroke
=
case_when(
`GMAL level`
==
1
~
"
#020060
"
,
`GMAL level`
==
2
~
"
#3175FF
"
,
`GMAL level`
==
3
~
"
#50C4FF
"
,
`GMAL level`
==
4
~
"
#8FFF90
"
,
`GMAL level`
==
5
~
"
#FED861
"
,
`GMAL level`
==
6
~
"
#FF8001
"
,
`GMAL level`
==
7
~
"
#D63027
"
,
`GMAL level`
==
8
~
"
#500001
"
),
`stroke-width`
=
0
,
fill
=
stroke
,
`fill-opacity`
=
0.8
)
#
write data ---------------------------
st_write(
sf
,
"
gm_GMAL.geojson
"
)
st_write(filter(
sf
,
`Area name`
==
"
Trafford
"
),
"
trafford_GMAL.geojson
"
)
Back
|
FazBrowse Home
|
New Git URL