11. BackgRound on R
• Developed in the 90s base on a Proprietary Statistical Language called
‘S’ and S-Plus, by Statisticians for Statistical Models.
12. Advantages of R - Spatial
• Command Line Interface
• Customizable Graphics
• Native Spatial Data
• Easily Extensible through Libraries
• Many Tools to Munge Data, both Spatial and Tabular
• Native Modeling and Analysis in Code
• Levels the Playing Field
13. Disadvantages of R - Spatial
• Steepish Learning Curve (even with Rstudio)
• Difficult to Visualize Data (lack of interactive canvas in Rstudio)
• Difficult to Dynamically Select things from a map
• Single Core Processing (can be augmented with Libraries)
• Libraries with overlapping functionalities
14. R in “Traditional” Spatial/GIS
• Spatial
• ArcGIS
• R interface supported by ESRI Open Project “R Bridge”
• QGIS
• Imbedded a Functionality
• Use R in the Native Script Editor
• GeoDA
• Native R code, and functionality
• gvSIG
• R plugin to allow
21. Libraries we’re Going to Focus On
• ggplot2 - Library for the declarative generation of graphics
• ggmap - Library for draping data over a Google, or Statman Basemap
• maps - displays data as maps, also contains Spatial Data
• mapdata - More Map data, extends maps
• rgdal - Access to the Geospatial Data Abstraction Library (GDAL). Creates
the ability to read datatypes and change projections
• maptools - library for building and manipulating spatial information
• rgeos - geometry operations
• Cairo - high quality graphic formats for export
• scales - assists in determining best place for breaks
22.
23.
24.
25.
26. What is Spatial Data
• Two Cataglories
• Vector
• Point / Multipoint
• Line/Multiline
• Polygon/Multipolygon
• Raster
• It’s a matrix of pixels and each pixel has numeric attributes
• Imagery
• Some generated graphics
27. Geospatial Data Formats
•Data within R packages – map, mapdata or oz
•Files or Endpoints with Latitude and Longitude attributes (just Points)
•Shapefiles
•Geopackage/geoJSON/GML
•Google or other cloud-based mapping api's
28. Warming up – A Simple Map
>library(maps)
>library(mapdata)
>map(“worldHires”, “Mexico”, xlim=c(-118.4, -
86.7),ylin=c(14.5321,32.71865), col=“purple”, fill=TRUE)
29.
30. Cooling Off – Another Simple Map
>library(maps)
>library(mapdata)
>map(“worldHires”,”Canada”, xilm=c(-141,-53),ylim=c(40,85), col=“red”,
fill=TRUE)
31.
32. Cooling Off – Fixed Zoom In
>library(maps)
>library(mapdata)
>map(“worldHires”,”Canada”, xlim=c(-140,-110),ylim=c(48.64),
col=“red”, fill=TRUE)