Harold Nelson
10/11/2021
Use R to read the data from Tobias.
## ── 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 plot it with ggplot2.
## 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)
It’s obvious that the data we want occupies only a very small portion of our screen area. There are probably small islands far to the west, essentially outliers. We need to focus on San Francisco.
Read the documentation for st_crop(). Then reduce sl to a reasonable size.
Note that west longitudes are negative.
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
Now we have a reasonable view of San Francisco.