forked from deanmarchiori/culburra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathculburra.Rmd
89 lines (70 loc) · 2.4 KB
/
culburra.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
---
title: "Culburra Map"
author: "Dean Marchiori"
date: "04/02/2020"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Setup
```{r}
library(osmdata)
library(dodgr)
library(tidyverse)
library(sf)
```
# Bounding Box
```{r}
bbox <- st_bbox(c(xmin = 150.739,
xmax = 150.8,
ymax = -34.903,
ymin = -34.94),
crs = st_crs(4326)) %>%
st_as_sfc()
```
# Get streets
```{r}
estimate_box <- osmdata::getbb("culburra beach, NSW, Australia")
streets_raw <- dodgr_streetnet(estimate_box, expand = 1)
```
# Clean streets
```{r}
streets <- streets_raw %>%
st_intersection(bbox) %>%
select(osm_id, name, highway) %>%
filter(!osm_id %in% c(43928836, 394813974, 43928837, 404519947, 225636408, 225636411, 225636412, 225636406, 331330145, 4996645, 9642735 )) %>%
mutate(highway = fct_recode(highway,
residential = "service",
residential = "unclassified",
path = "track",
path = "cycleway",
path = "footway"
))
```
# Make map
```{r}
ggplot(streets, aes(col = highway)) +
geom_sf(data = filter(streets, highway == 'path'), alpha = 0.4, show.legend = F) +
geom_sf(data = filter(streets, highway == 'residential'), alpha = 0.5, show.legend = F) +
geom_sf(data = filter(streets, highway == 'secondary'), alpha = 0.9, show.legend = F) +
scale_colour_manual(values = c("path" = "#70838B",
"residential" = "#0A5D81",
"secondary" = "#0A5D81")) +
labs(caption = "Culburra Beach",
y = "") +
expand_limits(y = c(-34.8980, -34.9482)) +
theme_minimal() +
theme(
plot.background = element_rect(fill = "#E4D9C6", color = NA),
panel.background = element_rect(fill = "#E4D9C6", color = NA),
panel.grid = element_blank(),
axis.text = element_text(colour = "#C7B18A", family = "Ubuntu Mono"),
axis.ticks = element_blank(),
panel.border = element_blank(),
plot.caption = element_text(family = "Ubuntu Mono", size = 85, vjust = -0.2, color = '#C7B18A'),
plot.margin = margin(22,10,22,10, "mm"))
ggsave('culburra.png', width = 297, height = 420, units = "mm", dpi = "retina")
```