-
Notifications
You must be signed in to change notification settings - Fork 0
/
TT_wk45.Rmd
66 lines (50 loc) · 1015 Bytes
/
TT_wk45.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
---
title: "TT45"
author: "Seth Kasowitz"
date: "11/2/2021"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
#install.packages("spDataLarge",
# repos = "https://nowosad.github.io/drat/", type = "source")
library(spData)
library(spDataLarge)
library(tidyverse)
library(sf)
library(raster)
library(tmap)
library(dplyr)
library(leaflet)
library(ggplot2)
```
```{r}
# Add fill layer to nz shape
tm_shape(nz) +
tm_fill()
```
```{r}
# Add border layer to nz shape
tm_shape(nz) +
tm_borders()
```
```{r}
# Add fill and border layers to nz shape
tm_shape(nz) +
tm_fill() +
tm_borders()
```
```{r}
map_nz = tm_shape(nz) + tm_polygons()
map_nz1 = map_nz +
tm_shape(nz_elev) + tm_raster(alpha = 0.7)
nz_water = st_union(nz) %>% st_buffer(22200) %>%
st_cast(to = "LINESTRING")
map_nz2 = map_nz1 +
tm_shape(nz_water) + tm_lines()
map_nz3 = map_nz2 +
tm_shape(nz_height) + tm_dots()
```
```{r}
tmap_arrange(map_nz1, map_nz2, map_nz3)
```