library(sf)
## Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
library(tmap)
## Breaking News: tmap 3.x is retiring. Please test v4, e.g. with
## remotes::install_github('r-tmap/tmap')
library(tigris)
## To enable caching of data, set `options(tigris_use_cache = TRUE)`
## in your R script or .Rprofile.
#Q1
storm_channel <- st_read('D:/Documents/RFiles/Datasets/StormChannels/StormChannels.shp')
## Reading layer `StormChannels' from data source
## `D:\Documents\RFiles\Datasets\StormChannels\StormChannels.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 12042 features and 17 fields
## Geometry type: MULTILINESTRING
## Dimension: XY
## Bounding box: xmin: 2024999 ymin: 13600410 xmax: 2249487 ymax: 13824430
## Projected CRS: NAD83 / Texas South Central (ftUS)
corridor_plans <- st_read('D:/Documents/RFiles/Datasets/CorridorPlans/CorridorPlans.shp')
## Reading layer `CorridorPlans' from data source
## `D:\Documents\RFiles\Datasets\CorridorPlans\CorridorPlans.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 12 features and 4 fields
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: 2058688 ymin: 13665110 xmax: 2178301 ymax: 13793820
## Projected CRS: NAD83 / Texas South Central (ftUS)
storm_channel <- st_transform(storm_channel,crs = 4326)
corridor_plans <- st_transform(corridor_plans,crs = 4326)
#Q2
intersected_channel <- st_intersection(storm_channel, corridor_plans)
## Warning: attribute variables are assumed to be spatially constant throughout
## all geometries
#Q3
bexar_ct <-tracts(state = "TX", county = "Bexar",cb=T)
## Retrieving data for the year 2022
## | | | 0% | |= | 1% | |= | 2% | |== | 2% | |== | 3% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |===== | 7% | |===== | 8% | |====== | 8% | |====== | 9% | |======= | 10% | |======= | 11% | |======== | 11% | |======== | 12% | |========= | 13% | |========== | 14% | |========== | 15% | |=========== | 15% | |=========== | 16% | |============ | 17% | |============= | 18% | |============= | 19% | |============== | 20% | |=============== | 21% | |================ | 22% | |================ | 23% | |================= | 24% | |================= | 25% | |================== | 26% | |=================== | 27% | |==================== | 29% | |====================== | 31% | |======================== | 34% | |========================== | 37% | |============================= | 41% | |================================= | 48% | |==================================== | 52% | |====================================== | 54% | |========================================= | 58% | |============================================ | 62% | |============================================== | 66% | |================================================= | 70% | |==================================================== | 74% | |======================================================= | 78% | |========================================================== | 82% | |============================================================ | 86% | |=============================================================== | 90% | |================================================================== | 94% | |======================================================================| 100%
tm_shape(bexar_ct)+
tm_borders()+
tm_shape(intersected_channel)+
tm_lines(col = "blue")
#Q4
library(raster)
## Loading required package: sp
LST <- raster("D:/Documents/RFiles/Datasets/LC09_028040_20230826.tif")
#Q5
LST <- setMinMax(LST)
LST <- LST - 273.15
cellStats(LST, max)
## [1] 61.28771
library(ggplot2)
library(rasterVis)
## Warning: package 'rasterVis' was built under R version 4.4.2
## Loading required package: lattice
gplot(LST) +
geom_tile(aes(fill = value)) +
scale_fill_viridis_c() +
labs() +
theme_minimal()
#Q6
plot(LST > 40, main = "LST>40",
col = c("#ffffff", "red"))