class: center, middle, inverse, title-slide # Geospatial Visualization using R ## Part 2: R Packages ### Bhaskar V. Karambelkar ### 2017/07/04 --- # Part2: R Packages - [CRAN Task View: Analysis of Spatial Data](https://CRAN.R-project.org/view=Spatial) - Spatial Data Containers - Read External Data - Spatial Data Operations - Static Maps - Interactive Maps - Odds-n-Ends --- # Spatial Data Containers - [sp](https://cran.r-project.org/package=sp): The old work-horse for vector data. - [sf](https://cran.r-project.org/package=sf): The "tidy" replacement for `sp`. - [geojson](https://cran.r-project.org/package=geojson): GeoJSON/TopoJSON web-friendly text-based formats. - [wkb](https://cran.r-project.org/package=wkb): Well-known in Binary Format - [raster](https://cran.r-project.org/web/packages/raster/): For raster data, duh! --- # Read External Data - [rgdal](https://cran.r-project.org/package=rgdal) / [gdalUtils](https://cran.r-project.org/package=gdalUtils): Supports reading from many spatial data file formats. - [geojsonio](https://cran.r-project.org/package=geojsonio): ROpenSci project to read GeoJSON/TopoJSON files. - [ncdf4](https://cran.r-project.org/package=ncdf4) / [RNetCDF](https://cran.r-project.org/package=RNetCDF) / [rhdf5](https://www.bioconductor.org/packages/release/bioc/html/rhdf5.html): Multi-Dimensional Spatial/Spatio-Temporal Data. - [rpostgis](https://cran.r-project.org/package=rpostgis) / [postGIStools](https://cran.r-project.org/package=postGIStools): Read/Write data from a [PostGIS](https://postgis.net/) database. - [RQGIS](https://cran.r-project.org/package=RQGIS) / [RSAGA](https://cran.r-project.org/package=SAGA) / [rgrass7](https://cran.r-project.org/package=rgrass7): Interface with external software. - [getlandsat](https://cran.r-project.org/package=getlandsat): A treasure trove of Landsat data. - [elevatr](https://cran.r-project.org/package=elevatr): Access elevation data via several web-services. - [tigris](https://cran.r-project.org/package=tigris) / [tidycensus](https://cran.r-project.org/package=tidycensus) / [acs](https://cran.r-project.org/package=acs) / [censusapi](https://cran.r-project.org/package=censusapi): Packages for US Census Bureau Data. - [eechidna](https://cran.r-project.org/package=eechidna) (AUS census) / [pdfetch](https://cran.r-project.org/package=pdfetch) (UK ONS), and [idbr](https://cran.r-project.org/package=idbr): For international census data. --- # Spatial Data Operations - [rgeos](https://cran.r-project.org/package=rgeos) / [gdistance](https://cran.r-project.org/package=gdistance) / [geosphere](https://cran.r-project.org/package=geosphere): Spatial Operations. - [spatstat](https://cran.r-project.org/package=spatstat) / [spdep](https://cran.r-project.org/package=spdep): Spatial Statistics and Analysis. - [spatgraphs](https://cran.r-project.org/package=spatgraphs): Graph Computation for point pattern analysis. - [maptools](https://cran.r-project.org/package=maptools): Many Spatial operations like combining spatial data. - [lawn](https://cran.r-project.org/package=lawn) / [geoaxe](https://cran.r-project.org/package=geoaxe): Operations on GeoJSON data. - [spatial.tools](https://cran.r-project.org/package=spatial.tools): For working with raster data. - [**rmapshaper**](https://cran.r-project.org/package=rmapshaper): Topology aware shape simplification. Use it, love it! --- # Static Maps - base plotting: Very Powerful .gray[<sup>1</sup>], but not intuitive (IMO). Many viz. packages provide extensions on top of this. - [cartography](https://cran.r-project.org/package=cartography): Various types of maps. A very handy package. - [tmap](https://cran.r-project.org/package=tmap): Thematic mapping. - [ggplot2](https://cran.r-project.org/package=ggplot2) / [ggalt](https://cran.r-project.org/package=ggalt) / [ggmap](https://cran.r-project.org/package=ggmap) / [ggspatial](https://cran.r-project.org/package=ggspatial): Tidyverse ecosystem for maps. - [choroplethr](https://cran.r-project.org/package=choroplethr): Choropleths! - [rasterVis](https://cran.r-project.org/package=rasterVis): For raster data, duh! - [gganimate](https://github.com/dgrtwo/gganimate) / [animation](https://cran.r-project.org/package=animation): Stitch a bunch of static plots for animation. Useful for spatio-temporal data .footnote[1 - See [Data Visualization with R](http://www.datavisualisation-r.com/), a new book that deals extensively with base plotting.] --- # Interactive Maps - [ggiraph](https://cran.r-project.org/package=ggiraph) : Convert ggplot2 charts to interactive charts. - [leaflet](https://cran.r-project.org/package=leaflet) / [leaflet.extras](https://cran.r-project.org/package=leaflet.extras) / [leaflet.minicharts](https://cran.r-project.org/package=leaflet.minicharts) / [leaflet.esri](https://cran.r-project.org/package=leaflet.esri): Web Maps using leaflet.js and plug-ins. - [mapview](https://cran.r-project.org/package=mapview) / [mapedit](https://github.com/r-spatial/mapedit): Interactive spatial visualization. - [rbokeh](https://cran.r-project.org/package=rbokeh) / [plotly](https://cran.r-project.org/package=plotly) / [highcharter](https://cran.r-project.org/package=highcharter): Solid interactive mapping packages based on different JavaScript libraries. --- # Odds-n-End - [cartogram](https://cran.r-project.org/package=cartogram) / [tilegramsR](https://cran.r-project.org/package=tilegramsR): Cartograms and Tilegrams, as alternative to Geographic maps. - [rnaturalearth](https://cran.r-project.org/package=rnaturalearth): Spatial data from the natural earth project. - [usmap](https://cran.r-project.org/package=usmap) / [albersusa](https://github.com/hrbrmstr/albersusa): USA Map with Alaska and Hawaii moved. - [RgoogleMaps](https://cran.r-project.org/package=RgoogleMaps) / [googleway](https://cran.r-project.org/package=googleway) / [plotGoogleMaps](https://cran.r-project.org/package=plotGoogleMaps) / [plotKML](https://cran.r-project.org/package=plotKML): Google maps and APIs. - [OpenStreetMap](https://cran.r-project.org/package=OpenStreetMap) / [osmdata](https://cran.r-project.org/package=osmdata): For working with OpenSteetMap project. --- class: inverse middle # Part 2: The End! Continue to [Part 3: Spatial Data](03-Spatial_Data.html) .footnote[Restart [Part2](02-R_Packages.html)]