forked from AdamWilsonLabEDU/2024-geo511-spatial-data-science-final-project-GEO511_QuartoProjectTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPractice.qmd
214 lines (171 loc) · 9.41 KB
/
Practice.qmd
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
---
title: "Land Cover Change Detection in Twin Cities Metro Area, Minnesota"
format: pdf
editor: visual
author: Olivia Adomabea
date: 12/02/2024
---
# Introduction
This project seeks to detect land cover changes in Twin Cities Metro Area(TCMA), Minnesota.
Understanding the dynamics of environmental transformations caused by natural processes and human activities requires detecting land cover change. Accurate detection helps inform sustainable land-use policies and mitigate environmental impacts, such as biodiversity decline and climate change. Land cover change detection is a critical tool for understanding the complex dynamics of land use and its impacts on the environment, society, and economy. As human activities, such as urban expansion, agricultural intensification, and deforestation, continue to alter the landscape, it becomes increasingly important to monitor and assess these changes over time. studying land cover changes is vital for understanding environmental, social, and economic systems. It informs policies, promotes sustainable development, enhances disaster resilience, and helps manage natural resources more effectively.This study attempt to answer the principal questions:
-What are the land cover change patterns that have occurred in TCMA, Minnesota from 2000 to 2020?
-What factors are causing these changes if there has been any change detected?
# Materials and methods
The data source and data processing and analyzing method are noted in the code chunk in r.
Packages installed/loaded:
-tidyverse
-terra
-RColorBrewer
-tmap
Data Source:
-Landsat 8 (path 28. row 29) from USGS
-copied path of downloaded data.
Code: The code associated with the project is well organized and easy to follow. Demonstrates mastery of R graphics and functions.
Data: The underlying data are publicly accessible via the web and downloaded/accessed within the Rmd script.
---
```{r}
# load packages
# install.packages("terra")
library(terra)
library(tidyverse)
library(RColorBrewer)
```
```{r}
# load raster file
landcover_path_2000 <- "Minnesota/Annual_NLCD_H18V05_LndCov_2000_CU_C1V0.tif"
landcover_path_2020 <- "Minnesota/Annual_NLCD_H18V05_LndCov_2020_CU_C1V0.tif"
landcover_2000 <- rast(landcover_path_2000)
landcover_2020 <- rast(landcover_path_2020)
print(landcover_2000)
print(landcover_2020)
```
```{r}
# explore raster file
landcover_cat_2000 <- unique(values(landcover_2000))
landcover_cat_2020 <- unique(values(landcover_2020))
print(landcover_cat_2000)
print(landcover_cat_2020)
```
```{r}
# count pixels per landcover category
landcover_2000_pc <- freq(landcover_2000, digits = 0)
print(landcover_2000_pc)
landcover_2020_pc <- freq(landcover_2020, digits = 0)
print(landcover_2020_pc)
```
```{r}
# for 2000
# convert pixel counts to a df
landcover_2000_pc <- as.data.frame(landcover_2000_pc[, c(2,3)])
colnames(landcover_2000_pc) <- c("Landcover_Class", "Pixel_Count_2000")
print(landcover_2000_pc)
# adding proportion to the df
total_pixels <- sum(landcover_2000_pc$Pixel_Count_2000)
landcover_2000_pc$Percentage_2000 <- (landcover_2000_pc$Pixel_Count_2000 / total_pixels) * 100
```
```{r}
# for 2020
# convert pixel counts to a df
landcover_2020_pc <- as.data.frame(landcover_2020_pc[, c(2,3)])
colnames(landcover_2020_pc) <- c("Landcover_Class", "Pixel_Count_2020")
print(landcover_2020_pc)
# adding proportion to the df
total_pixels <- sum(landcover_2020_pc$Pixel_Count_2020)
landcover_2020_pc$Percentage_2020 <- (landcover_2020_pc$Pixel_Count_2020 / total_pixels) * 100
```
```{r}
library(tidyverse)
lc_2000_2020 <- left_join(landcover_2000_pc, landcover_2020_pc, by = "Landcover_Class")
lc_2000_2020 <- lc_2000_2020 %>%
mutate(land_cover_class = case_when(
Landcover_Class == 11 ~ "open water",
Landcover_Class == 21 ~ "developed area",
Landcover_Class == 22 ~ "developed area",
Landcover_Class == 23 ~ "developed area",
Landcover_Class == 24 ~ "developed area",
Landcover_Class == 31 ~ "barren land",
Landcover_Class == 41 ~ "forest",
Landcover_Class == 42 ~ "forest",
Landcover_Class == 43 ~ "forest",
Landcover_Class == 52 ~ "grassland",
Landcover_Class == 71 ~ "grassland",
Landcover_Class == 81 ~ "grassland",
Landcover_Class == 82 ~ "cultivated crops",
Landcover_Class == 90 ~ "wetlands",
Landcover_Class == 95 ~ "wetlands"
))
lc_2000_2020 <- lc_2000_2020[, c(2:6)]
lc_2000_2020 <- lc_2000_2020 %>% group_by(land_cover_class) %>%
summarise(across(everything(), sum, na.rm = TRUE))
```
```{r}
# some exploratory data analysis
# 1. group bar plot
data <- lc_2000_2020 %>%
pivot_longer(cols = c(Percentage_2000, Percentage_2020),
names_to = "Year", values_to = "Value")
ggplot(data, aes(x = land_cover_class, y = Value, fill = Year)) +
geom_bar(stat = "identity", position = position_dodge()) +
labs(title = "Landcover Comparison by Year",
x = "Land Cover",
y = "Percent Coverage") +
theme_minimal() + scale_fill_brewer(palette = "Set1") +
theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1))
```
```{r}
# 2. visualizing the raster file spatially
n_classes <- length(lc_2000_2020$land_cover_class)
palette <- brewer.pal(n = n_classes, name = "Set3")
#
# plot(landcover_2000, col = palette, legend = TRUE,
# main = "Spatial Distribution of Landcover Categories\n of Southwestern Minnesota in 2000")
library(tmap)
tmap_mode("view")
tm_shape(landcover_2000) + tm_raster(title = "Landcover_Classes") +
tm_layout(title = "Spatial Distribution of Landcover Categories\n of Southwestern Minnesota in 2000", legend.outside = TRUE)
```
```{r}
plot(landcover_2020, col = palette, legend = TRUE,
main = "Spatial Distribution of Landcover Categories\n of Southwestern Minnesota in 2020")
library(tmap)
tmap_mode("view")
tm_shape(landcover_2020) + tm_raster(title = "Landcover_Classes") +
tm_layout(title = "Spatial Distribution of Landcover Categories\n of Southwestern Minnesota in 2020", legend.outside = TRUE)
```
```{r}
# preprocessing for change detection
landcover_2020 <- resample(landcover_2020, landcover_2000, method = "near")
# calculating change
change <- landcover_2020 - landcover_2000
```
```{r}
change[change == 0] <- NA
custom_colors <- c("white", "green", "blue", "yellow", "red", "purple")
# visualize change
tmap_mode("view")
tm_shape(change) + tm_raster(title = "Change") + tm_layout("Interactive Change Map")
plot(change, col = custom_colors[-1], legend = TRUE, main = "Landcover Changes (2000 - 2020)")
```
#Findings
From the analysis of the results, it was found that there has been a change detection in almost all the seven(7) landcovers. The developed area/built environment experienced a significant level of incremental changes. From 2000 to 2020, developed areas grew from 16.2% to 19.2% whereas there was a significant decrease in croplands from 29.2% to 26.9%. All the other landcovers(wetland, grasslands, and barren lands increased at 16.6%-16.7%, 14.1%-14.6,0.1%-0.2% respectively while open waters and forest decreased from 4.3%-4.1%, 18.7%-18.4% respectively. These findings indicate that vegetative covers are been lost to the built environment.
# Conclusions
In conclusion, detecting land cover changes is essential for comprehensively understanding the impacts of human activities and natural processes on the environment. Through advanced remote sensing technologies and data analysis techniques like R, land cover changes are effectively monitor and quantify shifts in land cover over time, providing valuable insights into urbanization, deforestation, agricultural expansion, and climate change. This information is critical for informed decision-making, allowing for the development of sustainable land use policies and effective conservation strategies. As global challenges such as biodiversity loss, climate change, and resource depletion intensify, continuous monitoring and detection of land cover changes will be pivotal in ensuring a balance between human development and environmental preservation, ultimately fostering a more resilient and sustainable future for the planet.In future, I will want to study land surface temperature to investigate if loss of vegetative covers give rise to urban heat island.
# References
Yuan, Fei, Kali E Sawaya, Brian C Loeffelholz, and Marvin E Bauer. 2005. “Land Cover Classification and Change Analysis of the Twin Cities (Minnesota) Metropolitan Area by Multitemporal Landsat Remote Sensing.” Remote Sensing of Environment 98 (2): 317–28. https://doi.org/10.1016/j.rse.2005.08.006.
Okeleye SO, Okhimamhe AA, Sanfo S, Fürst C. Impacts of Land Use and Land Cover Changes on Migration and Food Security of North Central Region, Nigeria. Land. 2023; 12(5):1012. https://doi.org/10.3390/land12051012
Choudhury U, Singh SK, Kumar A, Meraj G, Kumar P, Kanga S. Assessing Land Use/Land Cover Changes and Urban Heat Island Intensification: A Case Study of Kamrup Metropolitan District, Northeast India (2000–2032). Earth. 2023; 4(3):503-521. https://doi.org/10.3390/earth4030026
All sources are cited in a consistent manner
---
## Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
## Running Code
When you click the **Render** button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
```{r}
1 + 1
```
You can add options to executable code like this
```{r}
#| echo: false
2 * 2
```
The `echo: false` option disables the printing of code (only output is displayed).