findings from a search for r spatial analysis support · findings from a search for r spatial...

34
Findings from a Search for R Spatial Analysis Support Donald L. Schrupp Wildlife Ecologist Colorado Division of Wildlife (Retired)

Upload: others

Post on 01-Jun-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

Donald L. Schrupp – Wildlife EcologistColorado Division of Wildlife (Retired)

Page 2: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

=== Approach Steps ===

Install 'R' and RStudio

Search(s) for R Spatial Analysis Support

Findings:

• Packages

• Documentation

• Tutorials

Page 3: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Install 'R' and RStudio

'R' Source: http://cran-r-project.org

RStudio Source: http://rstudio.com

Page 4: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Search for R Spatial Analysis Support

R-Search: https://cran.r-project.org/search.html

Page 5: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Search for R Spatial Analysis Support

R Site Search: http://finzi.psych.upenn.edu/search.html

Page 6: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Search for R Spatial Analysis Support

R Site Search Results

FUNCTIONSVIGNETTESTASK VIEWS

Page 7: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Search for R Spatial Analysis Support

R Site Search Results - FUNCTIONS

Page 8: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Search for R Spatial Analysis Support

R Site Search Results - VIGNETTES

Page 9: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Search for R Spatial Analysis Support

R Site Search Results – TASK VIEW(S)

Page 10: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Search for R Spatial Analysis Support

CRAN TASK VIEW – Analysis of Spatial Data

https://cran.r-project.org/web/views/Spatial.html

Page 11: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Search for R Spatial Analysis Support

CRAN TASK VIEW – Analysis of Spatial Data

TOPIC AREAS

Classes for Spatial Data

Handling Spatial DataReading and Writing Spatial DataReading and Writing Spatial Data – Other PackagesVisualizationPoint Pattern AnalysisGeostatisticsDisease Mapping and Areal Data AnalysisSpatial RegressionEcological Analysis

Page 12: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

FINDINGS – PACKAGES

(168 Related Packages)

Ones I Installed in Working Through Tutorials (to date)

GISTools Some further GIS capabilities for R

gstat Spatial and Spatio-Temporal Geostatistical Modeling, Prediction and Simulation

maptools Tools for Reading and Handling Spatial Objectsraster Geographic Data Analysis and Modelingrgdal Bindings for Geospatial Data Abstraction Libraryrgeos Interface to Geometry Engine – Open Sources (GEOS)sp Classes and Methods for Spatial Dataspgrass6 Interface between GRASS 6+ GIS and R

Page 13: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

FINDINGS – DOCUMENTATION

sp: https://CRAN.R-project.org/package=spraster: https://CRAN.R-project.org/package=raster spgrass6: https://CRAN.R-project.org/package=spgrass6rgdal: https://CRAN.R-project.org/package=rgdal rgeos: https://CRAN.R-project.org/package=rgeosgstat: https://CRAN.R-project.org/package=gstatmaptools: https://CRAN.R-project.org/package=maptoolslattice: https://CRAN.R-project.org/package=latticerasterVis: https://CRAN.R-project.org/package=rasterVisGISTools: https://CRAN.R-project.org/package=GISTools

Page 14: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

FINDINGS – DOCUMENTATION – sp Example

Page 15: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

FINDINGS – DOCUMENTATION – sp Example

Page 16: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

FINDINGS – DOCUMENTATION – sp PDF -1

Page 17: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – DOCUMENTATION – sp PDF - 2

Page 18: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – DOCUMENTATION – sp PDF - 3

Page 19: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – DOCUMENTATION – sp PDF - 4

Page 20: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

FINDINGS – TUTORIALS

Spatial Analysis in R

NEON:

http://neondataskills.org/tutorial-series/

NPS: http://science.nature.nps.gov/datamgmt/statistics/advancedspatial.cfm

CRAN ( spgrass6 PDF )

https://cran.r-project.org/web/packages/spgrass6/spgrass6.pdf

Page 21: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

FINDINGS – TUTORIALSNEON: http://neondataskills.org/tutorial-series/

Page 22: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSNEON: http://neondataskills.org/tutorial-series/

TUTORIALS Cover: Metadata 1 tutorialRaster Data 8 tutorialsVector Data 6 tutorialsData Visualization 4 tutorialsGIS & Spatial Data in R and Python 18 tutorialsRemote Sensing 12 tutorialsHyperspectral Remote Sensing 7 tutorialsHierarchical Data Format – Version 5 9 tutorialsR Programming 45 tutorials

Data Sets and Coding is supplied; Necessary R Packages are specified

Page 23: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSNEON: http://neondataskills.org/tutorial-series/

TUTORIALS by 'R' Package Available for:

dplyr (7) ggplot2 (12) h5py (1)lubridate (6) maps (1) maptools (2)plyr (2) raster (25) rasterVis (3)rgdal (GIS) (21) rgeos (3) rhdf5 (11)sp (5) scales (4) gridExtra (4)grid (2) reshape2 (3)

Note: 'R_package_name' ( # ) [ of tutorials available ]

Page 24: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSNEON: http://neondataskills.org/tutorial-series/

TUTORIAL – Example Code in RStudio:

Page 25: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSNPS:

http://science.nature.nps.gov/im/datamgmt/statistics/r/advanced/spatial.cfm

Page 26: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSNPS: http://science.nature.nps.gov/datamgmt/statistics/advancedspatial.cfm

IntroductionWhy use R for spatial data ?Before the Webinar

Spatial ObjectsReading Spatial ObjectsWriting Spatial Objects

Creating kml files for Google Earth / Google MapsSpatial Overlays and ExtractionsRaster Computations

Package raster documentationWhy use R raster ?Key raster conceptsBasic raster function example:Raster for climate data analyses

Page 27: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSNPS: http://science.nature.nps.gov/datamgmt/statistics/advancedspatial.cfm

If you wish to download the data files and R code to play along at home, I have posted them on the NPS R website:

CABR data (DEM, Boundary, Slope, Aspect, Vegetation Map Polygons)

PRISM data from Colorado (for John Gross' raster examples. Extract the .gz files into a "prism/t_min" for John's code.)

tmin_1900.ziptmin_2010.ziptmin_sum_1901-1904.ziptmin_sum_2000-2004.zipCMIP3_Tavg_Monthly_A2.zip

Tom's R code using gdal, overlay, etc.

John's R code using raster

Tom's kmlPolygons.R function to generate labeled kml polygons for Google Earth & Google Maps

Page 28: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

`

FINDINGS – TUTORIALSCRAN ( spgrass6 PDF ) Documentation / Code Examples

https://cran.r-project.org/web/packages/spgrass6/spgrass6.pdf

Page 29: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSCRAN ( spgrass6 PDF )

Document Content Headings

IntroductionInstalling the interface packageThe sp packageUsing graphics with sp objectsUsing the spgrass6 package with raster dataUsing the spgrass6 package with vector dataConclusionReferences

Page 30: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSCRAN ( spgrass6 PDF ) Sample Code

library(spgrass6)

system("g.region -g3")

grand_nlcd <- readRAST6("Grand_County_NLCD_Attributed_N83_Z13", ignore.stderr = TRUE)

summary(grand_nlcd)

table(grand_nlcd$cat)

image(grand_nlcd, col = rev(colors(16)))

legend("top", legend = 11:12, fill = rev(colors(16)), cex = 0.8, bty = "n", horiz = TRUE)

legend("left", legend = 21:24, fill = rev(colors(16)), cex = 0.8, bty = "n", horiz = FALSE)

legend("right", legend = 41:43, fill = rev(colors(16)), cex = 0.8, bty = "n", horiz = FALSE)

legend("bottom", legend = 90:95, fill = rev(colors(16)), cex = 0.8, bty = "n", horiz = TRUE)

grand_dem <- readRAST6("Grand_County_CO_NED_30m", ignore.stderr = TRUE)

summary(grand)

table(grand_dem$cat)

image(grand_dem, col = rev(colors(10)))

Page 31: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – TUTORIALSCRAN ( spgrass6 PDF ) Example Code Outputs

Page 32: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGSGME: http://www.spatialecology.com/gme/

The Geospatial Modeling Environment (GME) is a platform designed to help to facilitate rigorous spatial analysis and

modeling.

GME provides you with a suite of analysis and modeling tools, ranging from small 'building blocks' that you can use to construct a sophisticated work-flow, to completely self-contained analysis programs. It also uses the extraordinarily powerful open source software R as the statistical engine to drive some of the analysis tools. One of the many strengths of R is that it is open source, completely transparent and well documented: important characteristics for any scientific analytical software.

Page 33: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

FINDINGS – Evolutionary DevelopmentsGME: http://www.spatialecology.com/gme/

Page 34: Findings from a Search for R Spatial Analysis Support · Findings from a Search for R Spatial Analysis Support Donald L. Schrupp –Wildlife Ecologist ... Disease Mapping and Areal

Findings from a Search for R Spatial Analysis Support

ACKNOWLEDGEMENTS and THANKS:

The R Development CommunityOpen Source Geospatial Community

NEON and NPS

QUESTIONS ?