class: center, middle, inverse, title-slide # Spatial data & visualization --- ## 1854 London Cholera Outbreak <img src="img/06/cholera.png" width="75%" style="display: block; margin: auto;" /> --- ## Napoleon's 1812 Russia Campaign <img src="img/06/napoleon.png" width="100%" style="display: block; margin: auto;" /> -- **Many others!** - [World Population Density](https://luminocity3d.org/WorldPopDen/#3/12.00/10.00) - [Global Power](https://www.gocompare.com/gas-and-electricity/what-powers-the-world/) --- ## Raster versus vector spatial data .vocab[Vector] spatial data describes the world using shapes (points, lines, polygons, etc). .vocab[Raster] spatial data describes the world using cells of constant size. <img src="img/06/vector_raster_comparison.png" width="40%" style="display: block; margin: auto;" /> The choice to use vector or raster data depends on the problem context. We will focus on vector data. *Source:* https://commons.wikimedia.org/wiki/File:Raster_vector_tikz.png --- Click the link below to create the repository for lecture notes #06 -https://classroom.github.com/a/SwGmBhHJ Follow the steps to clone the repo, make a new RStudio project, and configure git. Change the author name in the YAML header of `lecture06.Rmd` to your name and update the date to today's date. <br> Complete the Lab Team Formation Survey by 2-09 11:59 PM. Do this now if you have time. - [https://forms.gle/mZMZ53Zfy3yPHwdJ6](https://forms.gle/mZMZ53Zfy3yPHwdJ6) --- Simple features have a geometry type. Common choices are below. <img src="06-spatial_files/figure-html/unnamed-chunk-6-1.png" width="90%" style="display: block; margin: auto;" /> --- ## Spatial data plotting needs care <img src="06-spatial_files/figure-html/unnamed-chunk-7-1.png" width="75%" style="display: block; margin: auto;" /> --- ## Map Layers The North Carolina Department of Environment and Natural Resources, Wildlife Resources Commission and the NC Center for Geographic Information and Analysis has a [shapefile data set](https://www.nconemap.gov/datasets/e5ddff9b96204c6181be7c022e61d946_0) available on all public Game Lands in NC. ```r nc_game <- st_read("data/gamelands.shp", quiet = TRUE) ``` --- ```r ggplot(nc_game) + geom_sf() + theme_bw() + labs(title = "North Carolina gamelands") ``` <img src="06-spatial_files/figure-html/unnamed-chunk-9-1.png" style="display: block; margin: auto;" /> --- ```r ggplot(nc_game) + geom_sf(fill = "#ff6700") + theme_bw() + labs(title = "North Carolina gamelands") ``` <img src="06-spatial_files/figure-html/unnamed-chunk-10-1.png" style="display: block; margin: auto;" /> --- ```r ggplot(nc) + geom_sf() + geom_sf(data = nc_game, fill = "#ff6700", alpha = .5) + theme_bw() + labs(title = "North Carolina gamelands and counties") ``` <img src="06-spatial_files/figure-html/unnamed-chunk-11-1.png" style="display: block; margin: auto;" /> --- .tiny[ ```r ggplot(nc) + geom_sf() + geom_sf(data = nc_game, aes(alpha = SUM_ACRES), fill = "#ff6700") + theme_bw() + labs(title = "North Carolina gamelands and counties", fill = "Acres") ``` <img src="06-spatial_files/figure-html/unnamed-chunk-12-1.png" style="display: block; margin: auto;" /> ]