class: inverse, left, middle, nonum, clear background-image: url("figs/jungle.jpg") background-size: cover <br> <br> <br> <br> <br> <br> <br> <br> <br> # THE<br>LANDSCAPE<br>OF<br>SPATIAL DATA ANALYSIS IN R ### **Slides:** http://bit.ly/whyr19 .LARGE[**Jakub Nowosad | Why R? | 2019-09-28**] <!-- add ref--> <!--coverimage: https://search.creativecommons.org/photos/ceaa37a1-47b2-4d26-b3a7-3e8951b9c96b --> --- class: inverse, left, bottom, clear # Sidenote --- class: inverse, middle, center, clear # (geo)\*(<mark class="blue">spati</mark>|graphic)\*(<mark class="blue">al</mark>)\* <br> # ( )\*(stuff|<mark class="blue">data</mark>|comput|inform)\*(ing|ation)\* <br> # (science|systems|theory|<mark class="blue">analysis</mark>)\*) .footnote[Based on the David O’Sullivan's talk title at the Geocomputation 2019 conference] --- class: inverse, left, bottom, clear # Spatial data --- # Spatial data - GPS locations <!-- (*global navigation satellite system (GNSS)*) --> <!-- https://news.google.com/newspapers?nid=1053&dat=19971225&id=BfMkAAAAIBAJ&sjid=bBAGAAAAIBAJ&pg=707,375725 --> <!-- https://en.wikipedia.org/wiki/Global_Positioning_System#/media/File:GPS_Receivers.jpg --> <!--image--><!--some articles??--> <center> <p class="caption"> Pahrump Valley Gazette, 1997-12-25 </p> </center> <img src="figs/gps2.png" width="75%" style="display: block; margin: auto;" /> --- # Spatial data - Roads networks <center> <p class="caption"> https://www.move-lab.com/project/roadstorome/ </p> </center> <img src="figs/roads-to-rome.png" width="75%" style="display: block; margin: auto;" /> <!--image--><!--some articles??--> <!-- https://www.move-lab.com/project/roadstorome/?utm_medium=website&utm_source=archdaily.com --> --- # Spatial data - Administrative data <img src="figs/europe-map.png" width="55%" style="display: block; margin: auto;" /> <!-- https://jakubmarian.com/map-of-the-percentage-of-people-speaking-english-in-the-eu-by-country/ --> --- # Spatial data - Satelite data <!-- (e.g. RGB, multi-spectral) --> <!-- spatial resolution --> <!-- temporal resolution --> <!-- number of bands (wavelenghts) --> <!--compare of changes in resolution/times--> <center> <p class="caption"> Image Composites, http://gsp.humboldt.edu/OLM_2017/ </p> </center> <img src="figs/bands.jpg" width="70%" style="display: block; margin: auto;" /> <!-- http://gsp.humboldt.edu/OLM/Courses/GSP_216_Online/lesson3-1/composites.html --> --- # Spatial data - LIDAR <center> <p class="caption"> https://www.nationalgeographic.com/culture/archaeology/lasers-lidar-driving-revolution-archaeology/ </p> </center> <img src="figs/lidar.png" width="80%" style="display: block; margin: auto;" /> <!--image--><!--some articles??--> --- # Spatial data - Sensors <!-- - Temperature measurements --> <!-- - Sensors some articles??--> <!--image--><!--some articles??--> <center> <p class="caption"> Industry 4.0, Christoph Roser </p> </center> <img src="figs/Industry_4.0_NoText.png" width="90%" style="display: block; margin: auto;" /> <!-- https://commons.wikimedia.org/wiki/File:Industry_4.0_NoText.png --> --- # Spatial data and many more... A lot of spatial data is freely available: - http://freegisdata.rtwilson.com/ - https://data.nasa.gov/ - https://planet.parts/ - https://www.efi.int/knowledge/maps/forest - https://land.copernicus.eu/ - https://maps.elie.ucl.ac.be/CCI/viewer/ - https://www.ecad.eu//dailydata/predefinedseries.php - http://www.worldclim.org/version2 - https://www.geoportal.org/ - https://scihub.copernicus.eu/ - https://sedac.ciesin.columbia.edu/ - https://earthexplorer.usgs.gov/ <!-- how to improve --> <!-- add image --> --- class: inverse, left, bottom, clear # Cartography --- # Cartography .pull-left[ <div class="figure" style="text-align: center"> <img src="figs/imago-mundi.jpg" alt="https://en.wikipedia.org/wiki/Babylonian_Map_of_the_World" width="1067" /> <p class="caption">https://en.wikipedia.org/wiki/Babylonian_Map_of_the_World</p> </div> ] .pull-right[ <div class="figure" style="text-align: center"> <img src="figs/orbis-terrarum.jpg" alt="https://en.wikipedia.org/wiki/File:Orbis_Terrarum_Nova_et_Accuratissima_Tabula_by_Nicolaes_Visscher,_1658.jpg" width="1219" /> <p class="caption">https://en.wikipedia.org/wiki/File:Orbis_Terrarum_Nova_et_Accuratissima_Tabula_by_Nicolaes_Visscher,_1658.jpg</p> </div> ] --- # Cartography <div class="figure" style="text-align: center"> <img src="figs/usa-old-map.jpg" alt="World Atlas, PWN, 1962" width="80%" /> <p class="caption">World Atlas, PWN, 1962</p> </div> <!-- great looking map --> <!-- (take a photo from the JK's atlas) --> --- # Cartography <!-- next we got this - ugly map on a computer (in R? nope, from an old film) --> <!-- https://giphy.com/gifs/apocalypse-war-games-RN6sYUh5VIYlG --> <!-- look for something better --> <div class="figure" style="text-align: center"> <img src="figs/wargames2.png" alt="Still from WarGames (1983)" width="75%" /> <p class="caption">Still from WarGames (1983)</p> </div> <!-- https://hollywoodscreens.wordpress.com/2010/01/27/norad-screens-from-war-games/ --> <!-- old r ?? --> <!-- Cartography --> <!-- now --> <!-- also - new technologies - new limitations, but also new possibilities --> <!-- Why R? to make things faster, more efficient, easier to share/update/collaborate --> <!-- to innovate --> --- # Cartography <div class="figure" style="text-align: center"> <img src="figs/tmap-map.png" alt="https://github.com/mtennekes/tmap/tree/master/demo/ClassicMap" width="88%" /> <p class="caption">https://github.com/mtennekes/tmap/tree/master/demo/ClassicMap</p> </div> --- # Cartography <!-- https://rgeomatic.hypotheses.org/1536 --> <!-- https://riatelab.github.io/icc2019/#1 --> <div class="figure" style="text-align: center"> <img src="figs/cartography-map.png" alt="https://riatelab.github.io/MDM/" width="88%" /> <p class="caption">https://riatelab.github.io/MDM/</p> </div> --- # Cartography <div class="figure" style="text-align: center"> <img src="figs/worlds-animate.gif" alt="https://nowosad.github.io/post/maps-distortion/" /> <p class="caption">https://nowosad.github.io/post/maps-distortion/</p> </div> <!-- e.g. animated maps, --> --- # Cartography <img src="figs/climate-app.gif" width="75%" style="display: block; margin: auto;" /> <!-- interactive maps --> <center> <p class="caption"> https://fitzlab.shinyapps.io/cityapp/ </p> </center> --- # Cartography <!-- <video width="320" height="240"> --> <!-- <source src="figs/montbayaboveweb2.mp4" type="video/mp4"> --> <!-- </video> --> <div class="figure" style="text-align: center"> <img src="figs/montbayabove.gif" alt="https://www.tylermw.com/3d-maps-with-rayshader/" width="85%" /> <p class="caption">https://www.tylermw.com/3d-maps-with-rayshader/</p> </div> <!-- rayshader, mapdeck --> --- # Cartography .pull-left[ Book chapters: - [Making maps with R, Geocompuation with R](https://geocompr.robinlovelace.net/adv-map.html) - [Visualizing geospatial data, Fundamentals of Data Visualization](https://serialmentor.com/dataviz/geospatial-data.html) Other packages: - [mapview](https://github.com/r-spatial/mapview) - [mapdeck](https://github.com/SymbolixAU/mapdeck) - [cartogram](https://github.com/sjewo/cartogram) - [geogrid](https://github.com/jbaileyh/geogrid) - [geofacet](https://github.com/hafen/geofacet) - [cubeview](https://github.com/r-spatial/cubeview) - [cesium](https://github.com/r-spatial/cesium) - ... ] <!-- https://dadascience.design/post/r-gis-like-it-s-2019-pragmatic-workflows-pt-1/ --> .pull-right[ <div class="figure" style="text-align: center"> <img src="figs/textured-uluru.png" alt="https://github.com/ACEMS/r2vr" width="1444" /> <p class="caption">https://github.com/ACEMS/r2vr</p> </div> ] --- class: inverse, left, bottom, clear # Applications --- # Applications .pull-left[ <img src="index_files/figure-html/unnamed-chunk-17-1.png" style="display: block; margin: auto;" /> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-18-1.png" style="display: block; margin: auto;" /> ] --- # Ecology <!-- add packages names --> <!-- http://wheretheanimalsgo.com/ - ask Jadzia for the best story! --> <!-- gps data, etc. --> <!-- James Cheshire and Oliver Uberti --> <div class="figure" style="text-align: center"> <img src="figs/whereanimals.png" alt="http://wheretheanimalsgo.com/" width="100%" /> <p class="caption">http://wheretheanimalsgo.com/</p> </div> --- # Ecology <!-- SDM --> <!-- https://statnmap.com/2017-09-23-sdmselect-package-species-distribution-modelling/ --> <!-- https://cmerow.github.io/RDataScience/4_1_Wallace_SDMs.html --> <!-- http://spatialecology.weebly.com/r-code--data/category/sdm-maxent --> <!-- (landscapemetrics?) --> <!-- --> <!-- https://cmerow.github.io/RDataScience/index.html --> .pull-left[ <div class="figure" style="text-align: center"> <img src="figs/sdm1.png" alt="http://rpubs.com/kerkhoffa/SDMMaxent" width="1205" /> <p class="caption">http://rpubs.com/kerkhoffa/SDMMaxent</p> </div> ] .pull-right[ <div class="figure" style="text-align: center"> <img src="figs/sdm2.png" alt="http://rpubs.com/kerkhoffa/SDMMaxent" width="1588" /> <p class="caption">http://rpubs.com/kerkhoffa/SDMMaxent</p> </div> ] --- # Earth Observation <!-- global scale (or larger scale, but environmental) --> .lc[ <p class="caption"> https://soilgrids.org/ </p> ] .rc[ <img src="figs/soilgrid.png" width="100%" style="display: block; margin: auto;" /> ] --- # Earth Observation <!-- move to some application!! --> <!-- https://github.com/r-spatial/stars --> <!-- https://github.com/appelmar/gdalcubes --> <!-- https://www.mdpi.com/2306-5729/4/3/92 --> <!-- https://github.com/appelmar/opengeohub_summerschool2019 --> <!-- https://github.com/HannaMeyer/OpenGeoHub_2019/blob/master/slides/Practice_Hanna.pdf --> <!-- https://www.r-spatial.org//r/2019/07/18/gdalcubes1.html --> <div class="figure" style="text-align: center"> <img src="figs/cubes.png" alt="https://github.com/appelmar/opengeohub_summerschool2019" width="2037" /> <p class="caption">https://github.com/appelmar/opengeohub_summerschool2019</p> </div> <!-- problem? --> <!-- solution! --> --- # Earth Observation <div class="figure" style="text-align: center"> <img src="figs/datacubes.png" alt="https://www.mdpi.com/2306-5729/4/3/92" width="75%" /> <p class="caption">https://www.mdpi.com/2306-5729/4/3/92</p> </div> --- # Earth Observation <div class="figure" style="text-align: center"> <img src="figs/water-detection.png" alt="https://www.mdpi.com/2306-5729/4/3/92" width="4092" /> <p class="caption">https://www.mdpi.com/2306-5729/4/3/92</p> </div> --- # Demography <div class="figure" style="text-align: center"> <img src="figs/dot-map.png" alt="https://www.blog.cultureofinsight.com/2017/06/building-dot-density-maps-with-uk-census-data-in-r/" width="65%" /> <p class="caption">https://www.blog.cultureofinsight.com/2017/06/building-dot-density-maps-with-uk-census-data-in-r/</p> </div> --- # Demography <div class="figure" style="text-align: center"> <img src="figs/racial_landscape-imprv.png" alt="https://nowosad.github.io/raceland/" width="100%" /> <p class="caption">https://nowosad.github.io/raceland/</p> </div> <!-- https://nowosad.github.io/raceland/articles/raceland-intro3.html --> <!-- https://spatial.ly/2017/03/mapping-european-population/ --> --- # Demography .lc[ <p class="caption"> https://ikashnitsky.github.io/2018/the-lancet-paper/ </p> ] .rc[ <img src="figs/demography-map.png" width="80%" style="display: block; margin: auto;" /> ] --- # Economics .lc[ <p class="caption"> https://timogrossenbacher.ch/2019/04/bivariate-maps-with-ggplot2-and-sf/ </p> ] .rc[ <img src="figs/switz-inequality.png" width="90%" style="display: block; margin: auto;" /> ] --- # Economics .lc[ <p class="caption"> http://datatopics.worldbank.org/sdgatlas/index.html </p> > "All the figures in this Atlas are produced in R with ggplot2 or with QGIS. For a digital version of this publication and the source code for the majority of charts and maps, please refer to http://data.worldbank.org/sdgatlas" ] <!-- global scale (or larger scale, but economical) --> .rc[ <img src="figs/sdg-atlas.png" width="80%" style="display: block; margin: auto;" /> ] <!-- mention packages!!! --> --- # Economics <div class="figure" style="text-align: center"> <img src="figs/sdg-atlas-fig-pm25.png" alt="https://github.com/worldbank/sdgatlas2018/blob/master/sdg11.R#L270-L301" width="80%" /> <p class="caption">https://github.com/worldbank/sdgatlas2018/blob/master/sdg11.R#L270-L301</p> </div> <!-- Economics --> <!-- http://jsmayorga.com/post/mapping-the-global-network-of-transnational-fisheries/ --> <!-- https://ec.europa.eu/eurostat/web/products-manuals-and-guidelines/-/INSEE-ESTAT-SPATIAL-ANA?inheritRedirect=true&redirect=%2Feurostat%2Fpublications%2Fmanuals-and-guidelines --> <!-- (spdep + spatial_reg) --> --- # Journalism <!-- https://github.com/TheUpshot/prison-admissions --> <!-- https://www.nytimes.com/2016/09/02/upshot/new-geography-of-prisons.html --> <!-- http://www.machlis.com/R4Journalists/ --> <!-- https://www.buzzfeednews.com/article/peteraldhous/california-wildfires-people-climate --> <!-- https://buzzfeednews.github.io/2018-07-wildfire-trends/ --> .lc[ - https://www.nytimes.com/2016/09/02/upshot/new-geography-of-prisons.html <p class="caption"> https://github.com/TheUpshot/prison-admissions </p> ] .rc[ <img src="figs/prision.png" width="90%" style="display: block; margin: auto;" /> ] --- # Politics <!-- https://callumgwtaylor.github.io/blog/2017/06/05/using-sf-gganimate-and-the-humanitarian-data-exchange-to-map-acled-data-for-africa/ --> <div class="figure" style="text-align: center"> <img src="figs/gppi_syria.jpg" alt="https://www.gppi.net/2019/02/17/the-logic-of-chemical-weapons-use-in-syria/" width="68%" /> <p class="caption">https://www.gppi.net/2019/02/17/the-logic-of-chemical-weapons-use-in-syria/</p> </div> <!-- https://dadascience.design/post/r-gis-like-it-s-2019-pragmatic-workflows-pt-1/ --> --- # Transport <!-- https://optimalnetwork.github.io/ --> <!-- https://www.dataplanes.org/notes/2018/01/27/flight-routes-night-lights --> <!-- https://spatial.ly/2015/03/mapping-flows/ --> <!-- https://spatial.ly/2012/02/london-cycle-hire-pollution/ --> <div class="figure" style="text-align: center"> <img src="figs/pct.png" alt="https://www.pct.bike/" width="2207" /> <p class="caption">https://www.pct.bike/</p> </div> <!-- http://rpubs.com/RobinLovelace/316614 --> <!-- Shows on the map where there is high cycling potential, for 4 scenarios of change --> --- # Transport <div class="figure" style="text-align: center"> <img src="figs/pct-example2.png" alt="https://www.pct.bike/" width="90%" /> <p class="caption">https://www.pct.bike/</p> </div> <!-- Transport --> --- # Climatology/Meteorology .lc[ <p class="caption"> http://www.meteo.pl/ </p> ] .rc[ <img src="figs/meteo-pl.png" width="85%" style="display: block; margin: auto;" /> ] <!-- https://owi.usgs.gov/blog/furthest-water/ --> <!-- https://www.katiejolly.io/blog/2019-08-28/nyt-urban-heat --> <!-- https://webgr.irstea.fr/en/software/airgrteaching/?fbclid=IwAR0JN9xlDfH1uUCRGwyr1mvB5oOTOvEAKaC2zlHhZA1lBuGdINbjeSmC5TY --> <!-- https://esdlab.met.no/decmapps/?fbclid=IwAR288yKeUQYbrD8U0vlQT4PGcq4jkgeWOct_jgqIlajdeajF0ayGr3hSWL4 --> <!-- https://crt-climate-explorer.nemac.org/variables/?id=days_tmax_gt_90f&left=historical&leftyear=avg&right=rcp85&rightyear=2090&extent=-128.65%2C-63.35%2C21.49%2C51.75&zoom=5&fbclid=IwAR3T7YJav2Orlw67VqZ-v-LmDn00d4wArSBUM9aw9OIweoUq_rhPXGkbxaA --> <!-- --- --> <!-- # Geology --> <!-- geostat?? --> --- # History/archeology <!-- Reprocucibility revolution --> <!-- psychology --> <!-- nice example - what are the fields that are still missing out? --> <!-- https://benmarwick.github.io/How-To-Do-Archaeological-Science-Using-R/ --> .lc[ <p class="caption"> https://benmarwick.github.io/How-To-Do-Archaeological-Science-Using-R/ </p> ] .rc[ <img src="figs/archeology.png" width="90%" style="display: block; margin: auto;" /> ] <!-- https://github.com/benmarwick/ctv-archaeology --> <!-- http://faculty.washington.edu/bmarwick/ --> <!-- https://benmarwick.github.io/How-To-Do-Archaeological-Science-Using-R/ --> <!-- https://www.andrewheiss.com/blog/2017/08/10/exploring-minards-1812-plot-with-ggplot2/ --> <!-- https://methodsblog.com/2017/05/02/historical-land-use-maps/ --> --- # Hobbies .pull-left[ <div class="figure" style="text-align: center"> <img src="figs/mtb-track.png" alt="https://yetanotheriteration.netlify.com/2018/01/ploting-your-mtb-track-with-r/" width="100%" /> <p class="caption">https://yetanotheriteration.netlify.com/2018/01/ploting-your-mtb-track-with-r/</p> </div> ] .pull-right[ <div class="figure" style="text-align: center"> <img src="figs/sunmodel.gif" alt="https://www.waldrn.com/the-shadiest-spots-in-downtown-indianapolis/" width="100%" /> <p class="caption">https://www.waldrn.com/the-shadiest-spots-in-downtown-indianapolis/</p> </div> ] <!-- https://yetanotheriteration.netlify.com/2018/01/ploting-your-mtb-track-with-r/ --> <!-- https://statnmap.com/2018-10-28-play-with-spatial-tools-on-3d-cells-images/ --> <!-- https://www.waldrn.com/the-shadiest-spots-in-downtown-indianapolis/ --> <!-- MARS?? --> --- # Journalism + Climatology/Meteorology + Hobby .lc[ <p class="caption"> https://www.katiejolly.io/blog/2019-08-28/nyt-urban-heat </p> ] .rc[ <img src="figs/urban-heat-island-map1.png" width="55%" style="display: block; margin: auto;" /> ] --- # Non-spatial <p class="caption"> https://statnmap.com/2018-10-28-play-with-spatial-tools-on-3d-cells-images/ </p> .pull-left[ <img src="figs/meshtosf-1.jpeg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="figs/mesh.gif" width="80%" style="display: block; margin: auto;" /> ] --- class: inverse, left, bottom, clear # Why R? --- # Why R? #### Do we even need R for spatial data analysis? Why? #### Are not there any existing software? -- .pull-left[ ## **Yes, there are...** ] .pull-right[ <img src="figs/gis-logos.png" width="100%" style="display: block; margin: auto;" /> ] -- ## **...but...** --- # Why R? <img src="figs/gis-logos.png" width="70%" style="display: block; margin: auto;" /> Existing GIS software: - Some are closed-source <!--I argue non scientific--> <!-- Most are point and click--> <!--A limitation to learn programming, aka freedom--> - **Focuses on spatial data, spatial analysis, and maps** <!--It is fine, but not for all requirements--> --- # Why R? .pull-left[ <img src="figs/r.png" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <split into several slides> <!-- Vast amount of data freely (~) available --> **Why R?** - Repeatability and reproducibility - Automation - Expandability - Spatial data analysis is a part of a workflow (not necessary the center of it) - It is possible to connect R with GIS software **R and GIS have one important thing in common - they are very universal!** <!-- - Universality - not only GIS --> <!-- https://andyteucher.ca/presentations/vic-geogeeks-2018-01-30/vic-geogeeks-2018-01-30.html#33 --> <!-- https://rsbivand.github.io/geostat19_talk/geostat_bivand_19.html --> ] --- class: inverse, left, bottom, clear # How to start? --- # How to start? <!-- There is a lot to learn... --> .pull-left[ <img src="figs/cover.png" width="66%" style="display: block; margin: auto;" /> ] .pull-right[ **Resources:** - https://geocompr.github.io/ - http://r-spatial.org/book - https://www.rspatial.org/ - https://spacetimewithr.org/ - `#rspatial` and `#geocompr` on Twitter - https://gis.stackexchange.com/questions/tagged/r - https://stat.ethz.ch/mailman/listinfo/r-sig-geo **Get involved:** - Packages repositories at https://github.com/ - Suggestions - Bugs report - Improvements to the documentation, e.g. clarifying unclear sentences, fixing typos - Changes to the code ] <!-- https://geocompr.github.io/ --> <!-- also the rest of resources --> <!-- tons to learn, e.g. projections (https://store.usgs.gov/assets/mod/storefiles/PDF/16573.pdf), file formats --> <!-- Conclusions --> <!-- - going back to the cartography alegory - old, new, (let's create) better future --> <!-- - 11. End with geocompr for public good --> <!-- spatial is not only about maps - is about how to get information with the spatial context --> --- class: left, top, clear ### **Slides:** http://bit.ly/whyr19 <br> .pull-left[ ## Summary: - Spatial data is all around us - R is great for working with spatial data - `#rspatial` future looks bright - Think if (how) `#rspatial` can help you solve your problems - Get involved! ] .pull-right[ ## Contact: Twitter:
jakub_nowosad ## Resources: https://nowosad.github.io https://geocompr.github.io ] .footnote[ <p style="font-size: 0.9rem;font-style: italic;">Title slide image: <a href="http://www.flickr.com/photos/135085206@N08/26476997010">"DSC03270"</a><span>by <a href="http://www.flickr.com/photos/135085206@N08">lippel82</a></span> licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=ccsearch&atype=html" style="margin-right: 5px;">CC BY-NC-SA 2.0</a><a href="https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=ccsearch&atype=html" target="_blank" rel="noopener noreferrer" style="display: inline-block;white-space: none;opacity: .7;margin-top: 2px;margin-left: 3px;height: 22px !important;"><img style="height: inherit;margin-right: 3px;display: inline-block;" src="https://search.creativecommons.org/static/img/cc_icon.svg" /><img style="height: inherit;margin-right: 3px;display: inline-block;" src="https://search.creativecommons.org/static/img/cc-by_icon.svg" /><img style="height: inherit;margin-right: 3px;display: inline-block;" src="https://search.creativecommons.org/static/img/cc-nc_icon.svg" /><img style="height: inherit;margin-right: 3px;display: inline-block;" src="https://search.creativecommons.org/static/img/cc-sa_icon.svg" /></a></p> ]