Harold Nelson
10/17/2021
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.3 ✓ purrr 0.3.4
## ✓ tibble 3.1.2 ✓ dplyr 1.0.6
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## Linking to GEOS 3.8.1, GDAL 3.2.1, PROJ 7.2.1
## Loading required package: sp
##
## Attaching package: 'raster'
## The following object is masked from 'package:dplyr':
##
## select
## The following object is masked from 'package:tidyr':
##
## extract
Read it and crop it.
## Reading layer `Shoreline' from data source `/Users/haroldnelson/Dropbox/QGIS/Tobias/Shoreline.shp' using driver `ESRI Shapefile'
## Simple feature collection with 1 feature and 6 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -123.1086 ymin: 37.69325 xmax: -122.3277 ymax: 37.92975
## Geodetic CRS: WGS84(DD)
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
## Reading layer `StreetCenterlines' from data source `/Users/haroldnelson/Dropbox/QGIS/Tobias/StreetCenterlines.shp' using driver `ESRI Shapefile'
## Simple feature collection with 16241 features and 21 fields
## Geometry type: LINESTRING
## Dimension: XY
## Bounding box: xmin: -122.5136 ymin: 37.70702 xmax: -122.3583 ymax: 37.83213
## Geodetic CRS: WGS84(DD)
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## TreeID = col_double(),
## qLegalStatus = col_character(),
## qSpecies = col_character(),
## qAddress = col_character(),
## SiteOrder = col_double(),
## qSiteInfo = col_character(),
## PlantType = col_character(),
## qCaretaker = col_character(),
## qCareAssistant = col_character(),
## PlantDate = col_character(),
## DBH = col_double(),
## PlotSize = col_character(),
## PermitNotes = col_character(),
## XCoord = col_double(),
## YCoord = col_double(),
## Latitude = col_double(),
## Longitude = col_double(),
## Location = col_character()
## )
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj
## = prefer_proj): Discarded datum Unknown based on WGS84 ellipsoid in Proj4
## definition
## Warning in showSRID(SRS_string, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded datum WGS84 in Proj4 definition
ggplot(data = shoreline) +
geom_sf() +
geom_sf(data = streets) +
geom_sf(data = sycamores_sf,size=.01,color = "green") +
geom_raster(data = DEM_tr_df,aes(x=x,y=y,fill = DEM_SF),
alpha=.5,)
I also played with the size parameter of shoreline and the alpha parameter of the raster.
ggplot(data = shoreline) +
geom_sf(size = .2) +
geom_sf(data = streets) +
geom_sf(data = sycamores_sf,size=.01,color = "green") +
geom_raster(data = DEM_crop,aes(x=x,y=y,fill = DEM_SF),
alpha=.8) +
theme_bw()
tm_shape(shoreline) +
tm_polygons() +
tm_shape(DEM_tr) +
tm_raster() +
tm_shape(streets) +
tm_lines() +
tm_shape(sycamores_sf) +
tm_dots()
## stars object downsampled to 1099 by 910 cells. See tm_shape manual (argument raster.downsample)
## Variable(s) "NA" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.