library(sf)
## Linking to GEOS 3.9.3, GDAL 3.5.2, PROJ 8.2.1; sf_use_s2() is TRUE
library(tigris)
## To enable caching of data, set `options(tigris_use_cache = TRUE)`
## in your R script or .Rprofile.
library(tmap)
## Warning: package 'tmap' was built under R version 4.2.3
## Breaking News: tmap 3.x is retiring. Please test v4, e.g. with
## remotes::install_github('r-tmap/tmap')
library(raster)
## Loading required package: sp
#Q1
bexar_tracts<- tracts(state = "TX", county = "Bexar",cb=T)
## Retrieving data for the year 2021
##
|
| | 0%
|
|= | 1%
|
|= | 2%
|
|== | 2%
|
|== | 3%
|
|== | 4%
|
|=== | 4%
|
|=== | 5%
|
|==== | 5%
|
|==== | 6%
|
|===== | 7%
|
|====== | 8%
|
|====== | 9%
|
|======= | 9%
|
|======= | 10%
|
|======== | 11%
|
|========= | 12%
|
|========= | 13%
|
|========== | 14%
|
|========== | 15%
|
|=========== | 15%
|
|=========== | 16%
|
|============ | 17%
|
|============ | 18%
|
|============= | 18%
|
|============= | 19%
|
|============== | 19%
|
|============== | 20%
|
|=============== | 21%
|
|=============== | 22%
|
|================ | 22%
|
|================ | 23%
|
|================= | 24%
|
|================= | 25%
|
|================== | 25%
|
|================== | 26%
|
|=================== | 27%
|
|=================== | 28%
|
|==================== | 28%
|
|==================== | 29%
|
|===================== | 30%
|
|===================== | 31%
|
|====================== | 31%
|
|====================== | 32%
|
|======================= | 32%
|
|======================= | 33%
|
|======================== | 34%
|
|======================== | 35%
|
|========================= | 35%
|
|========================= | 36%
|
|========================== | 37%
|
|=========================== | 38%
|
|=========================== | 39%
|
|============================ | 40%
|
|============================ | 41%
|
|============================= | 41%
|
|============================= | 42%
|
|============================== | 42%
|
|============================== | 43%
|
|=============================== | 44%
|
|=============================== | 45%
|
|================================ | 45%
|
|================================ | 46%
|
|================================= | 47%
|
|================================= | 48%
|
|================================== | 48%
|
|================================== | 49%
|
|=================================== | 50%
|
|==================================== | 51%
|
|==================================== | 52%
|
|===================================== | 53%
|
|====================================== | 54%
|
|====================================== | 55%
|
|======================================= | 56%
|
|======================================== | 57%
|
|======================================== | 58%
|
|========================================= | 59%
|
|========================================== | 60%
|
|=========================================== | 61%
|
|=========================================== | 62%
|
|============================================ | 63%
|
|============================================= | 64%
|
|============================================= | 65%
|
|============================================== | 65%
|
|============================================== | 66%
|
|=============================================== | 67%
|
|=============================================== | 68%
|
|================================================ | 69%
|
|================================================= | 70%
|
|================================================= | 71%
|
|================================================== | 71%
|
|================================================== | 72%
|
|=================================================== | 73%
|
|==================================================== | 74%
|
|==================================================== | 75%
|
|===================================================== | 76%
|
|====================================================== | 77%
|
|====================================================== | 78%
|
|======================================================= | 79%
|
|======================================================== | 80%
|
|======================================================== | 81%
|
|========================================================= | 82%
|
|========================================================== | 82%
|
|========================================================== | 83%
|
|========================================================== | 84%
|
|=========================================================== | 84%
|
|=========================================================== | 85%
|
|============================================================ | 86%
|
|============================================================= | 86%
|
|============================================================= | 87%
|
|============================================================== | 88%
|
|============================================================== | 89%
|
|=============================================================== | 89%
|
|=============================================================== | 90%
|
|================================================================ | 91%
|
|================================================================ | 92%
|
|================================================================= | 92%
|
|================================================================= | 93%
|
|================================================================== | 94%
|
|================================================================== | 95%
|
|=================================================================== | 95%
|
|=================================================================== | 96%
|
|==================================================================== | 97%
|
|===================================================================== | 98%
|
|===================================================================== | 99%
|
|======================================================================| 99%
|
|======================================================================| 100%
Bondline <- st_read(dsn = "C:/Users/salom/OneDrive/Desktop/BondProjectLines2017/BondProjectLines2017/BondProjectLines2017.shp")
## Reading layer `BondProjectLines2017' from data source
## `C:\Users\salom\OneDrive\Desktop\BondProjectLines2017\BondProjectLines2017\BondProjectLines2017.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 69 features and 24 fields
## Geometry type: MULTILINESTRING
## Dimension: XY
## Bounding box: xmin: 2078269 ymin: 13665110 xmax: 2168346 ymax: 13783530
## Projected CRS: NAD83 / Texas South Central (ftUS)
Bondline <- st_transform(Bondline, crs=4326)
buffer_distance <- 0.01
Bondline <-st_buffer(Bondline, dist = buffer_distance)
tm_shape(bexar_tracts)+
tm_borders()+
tm_shape(Bondline)+
tm_borders(lwd = 2, col = "Green")+
tm_layout(frame = F)
#Q2
Libraries <- st_read(dsn= "C:/Users/salom/OneDrive/Desktop/Libraries/Libraries/Libraries.shp")
## Reading layer `Libraries' from data source
## `C:\Users\salom\OneDrive\Desktop\Libraries\Libraries\Libraries.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 30 features and 9 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: 2075828 ymin: 13669240 xmax: 2170361 ymax: 13779280
## Projected CRS: NAD83 / Texas South Central (ftUS)
Libraries <- st_transform(Libraries, crs=4326)
tmap_mode("view")
## tmap mode set to interactive viewing
tm_shape(bexar_tracts) +
tm_borders() + # Add borders for polygons (customize as needed)
tm_shape(Libraries) +
tm_dots(size = 0.02, col = "red", alpha = 0.7) + # Customize point appearance
tm_basemap() +
tm_layout(title = "SA Libraries", frame = FALSE)
#Q3
LST <- raster('C:/Users/salom/Downloads/LC09_028040_20230826.tif')
LST <- setMinMax(LST)
LST
## class : RasterLayer
## dimensions : 7779, 7542, 58669218 (nrow, ncol, ncell)
## resolution : 30, 30 (x, y)
## extent : 311265, 537525, 3076545, 3309915 (xmin, xmax, ymin, ymax)
## crs : +proj=utm +zone=14 +datum=WGS84 +units=m +no_defs
## source : LC09_028040_20230826.tif
## names : LST
## values : 272.8423, 334.4377 (min, max)
#Q4
LST <- LST-273.15
plot(LST, main="LST of Dallas") # add title with main
#Q5
image(LST, zlim=c(40,100))