Book Image

Learning R for Geospatial Analysis

By : Michael Dorman
Book Image

Learning R for Geospatial Analysis

By: Michael Dorman

Overview of this book

Table of Contents (18 chapters)
Learning R for Geospatial Analysis
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
External Datasets Used in Examples
Cited References
Index

Mapping the annual temperature in Spain


In the previous sections, we saw how to perform spatial interpolation of point data in R using several methods, including IDW, OK, and UK. We also learned that, in the case of minimum temperature in 2002, UK outperformed the other two methods in terms of accuracy, with a LOOCV RMSE value of 1.46, compared to 1.88 and 1.68 for IDW and OK, respectively. In this section, we are going to see how we can automate spatial interpolation in order to produce a set of temperature maps for different years with a single code execution command. For this purpose, we are going to construct two loops:

  • The first loop will go through 20 point layers (10 years * 2 variables), each time calculating the RMSE of LOOCV in prediction using each of the three methods (IDW, OK, and UK). Based on the results, we will select the most accurate method (on average) out of these three.

  • We will then construct the second loop to produce predicted temperature maps of Spain (for 5 years...