-
Notifications
You must be signed in to change notification settings - Fork 0
/
skopje-map.Rmd
124 lines (101 loc) · 2.78 KB
/
skopje-map.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
---
title: "Skopje map"
output: html_notebook
---
```{r}
library(tidyverse)
library(osmdata)
library(cowplot)
```
```{r}
getbb("Skopje North Macedonia")
streets <- getbb("Skopje North Macedonia")%>%
opq()%>%
add_osm_feature(key = "highway",
value = c("motorway", "primary",
"secondary", "tertiary")) %>%
osmdata_sf()
streets
```
```{r}
small_streets <- getbb("Skopje North Macedonia")%>%
opq()%>%
add_osm_feature(key = "highway",
value = c("residential", "living_street",
"unclassified",
"service", "footway")) %>%
osmdata_sf()
river <- getbb("Skopje North Macedonia") %>%
opq()%>%
add_osm_feature(key = "waterway", value = "river") %>%
osmdata_sf()
```
```{r}
ggplot() +
geom_sf(data = streets$osm_lines,
inherit.aes = FALSE,
color = "black",
size = .4,
alpha = .8) +
```
```{r}
ggplot() +
geom_sf(data = streets$osm_lines,
inherit.aes = FALSE,
color = "black",
size = .4,
alpha = .8) +
geom_sf(data = small_streets$osm_lines,
inherit.aes = FALSE,
color = "black",
size = .4,
alpha = .6) +
geom_sf(data = river$osm_lines,
inherit.aes = FALSE,
color = "black",
size = .2,
alpha = .5) +
coord_sf(xlim = c(21.31541, 21.53771),
ylim = c(41.94003, 42.04918),
expand = FALSE)
```
```{r}
p <- ggplot() +
geom_sf(data = streets$osm_lines,
inherit.aes = FALSE,
color = "black",
size = .4,
alpha = .8) +
geom_sf(data = small_streets$osm_lines,
inherit.aes = FALSE,
color = "azure4",
size = .4,
alpha = .6) +
geom_sf(data = river$osm_lines,
inherit.aes = FALSE,
color = "navy",
size = .5,
alpha = .5) +
coord_sf(xlim = c(21.31541, 21.53771),
ylim = c(41.94003, 42.04918),
expand = FALSE)
p <- p +
#labs(title = "Скопје", subtitle = "42°0′N / 21°26′E") +
theme_bw() +
theme(axis.text = element_blank(),
axis.ticks = element_blank(),
panel.grid = element_blank(),
panel.border = element_rect(color = "black", size = 1))
# plot.title = element_text(hjust = 0.5),
# plot.subtitle = element_text(hjust = 0.5))
#Not sure if this is the right way to have text below the plot
p <- gridExtra::grid.arrange(p, bottom="С К О П Ј Е\n42°0′N / 21°26′E")
p
```
```{r}
# Add the coat of arms
logo_file <- png::readPNG("./coat.png")
ggdraw(p) +
draw_image(logo_file, x = 1, y = 1, hjust = 6.9, vjust = 4.2, width = 0.13, height = 0.2)
ggsave("map.png", width = 6.6, height = 4.2)
```