Difference between revisions of "R Studio’s Spatial Capabilities going 3D!"
Line 46: | Line 46: | ||
In the context of mapping it involves using variables like the latitude, longitude and elevation to create a 3D image, akin to a DEM on Arc. |
In the context of mapping it involves using variables like the latitude, longitude and elevation to create a 3D image, akin to a DEM on Arc. |
||
+ | |||
+ | Before writing any code the '''lattice package''' needs to be installed. |
||
+ | Clicking on the '''Tools''' tab and clicking '''Install Packages''' brings up the Install Packages Window. In the blank '''Packages''' box type in the desired package and click '''Install'''. |
||
+ | |||
+ | This will take a few seconds to successfully read in but will allow you to use all of what the package can offer. |
||
Here's what the code looks like. |
Here's what the code looks like. |
Revision as of 15:03, 17 December 2017
Contents
Purpose
This tutorial prominently centres on the spatial abilities of R Studio; an open software program with its own scripting language that is often used for data analysis, statistics and graphing of very large datasets. Throughout the studies of Carleton students, R Studio most likely has been used for its powerful statistical capabilities and graphing.
But the software can do so much more!
The spatial data package offers a wide range of tools that can take data and create custom maps with a myriad of customization. By no means is this package an equivalent to ArcMap or other such dedicated mapping platforms but R can do many of the same things with their own advantages.
For more about the spatial data package follow this link: https://cran.r-project.org/web/packages/sp/sp.pdf
This tutorial shows how one could create 3D maps or images using the R language – if your not familiar with R or some of its other mapping capabilities see the following tutorials;
Julia Riddick -> R Studio's Spatial Capabilities at http://gracilis.carleton.ca/CUOSGwiki/index.php/R_Studio%27s_Spatial_Capabilities
Uzayr Siddiqui -> Introducing Geoprocessing Capabilities of SAGA in R Environment using RSAGA (Saga + Rstudio) at http://gracilis.carleton.ca/CUOSGwiki/index.php/Introducing_Geoprocessing_Capabilities_of_SAGA_in_R_Environment_using_RSAGA_(Saga_%2B_Rstudio)
Objective
The objective of this tutorial is to develop the users R Studio skills, competence in the R language and to demonstrate some of the various ways that 3D maps and images can be created.
The goal is to get users thinking on how R can do more than just stats but also map. An introduction of sorts getting users to thinking beyond tables or lists and thinking in 3 dimensions.
Software Introduction
Rstudio
This is an open software program that creates a user-friendly graphic user interface for accessing the R statistical analysis and scripting language. R is often used for data analysis, statistics and graphing of very large datasets. It also has the ability to interface with the SAGA spatial analysis program, through the 69 modules shown below; users are able to use spatial data and manipulate and perform geoprocessing via special commands within this software. The more you explore and use the commands the more comfortable you will get. Initially everyone may face difficulty, however, if the basics are understood well, it eases major geoprocessing tools. R studio is known for handling large datasets with efficiency and helps in optimizing results quicker in order to perform them multiple times at a time without the needs to run through the steps again and again. Also, R not only processes data but if users may want to visualize their spatial output of their data, R has a package called sp which has that feature.
To download RStudio click the link --> https://www.rstudio.com/products/rstudio/download/
There's a great introduction on the R Studio layout and configuration found on Julia Riddick's R Studio's Spatial Capabilities at http://gracilis.carleton.ca/CUOSGwiki/index.php/R_Studio%27s_Spatial_Capabilities, so take a look and become familiar with the software.
Throughout this tutorial we'll en devour to us datasets that are pre-installed in R, saving users time in tracking down data as well as for simplicity. R studio has a great volcano dataset that represents Maunga Whau (Mt Eden). This mountain is one of about 50 volcanos in the Auckland volcanic field. This data set gives topographic information for Maunga Whau on a 10m by 10m grid.
The scripts that this tutorial will be using will be straight forward and simple, users will need to do some thinking on their own to wrap their heads around how to apply techniques elsewhere.
3D Mapping in a Myriad of Ways
Lattice (Wireframe)
A straight forward method of creating a 3D image on R can be done using the Lattice package. This creates powerful and elegant graphics with minimum tuning.
At it's most basic level what this package will do is create a 3D scatter plot (using x, y, z) and draw wires across all the points creating a 3D image.
In the context of mapping it involves using variables like the latitude, longitude and elevation to create a 3D image, akin to a DEM on Arc.
Before writing any code the lattice package needs to be installed. Clicking on the Tools tab and clicking Install Packages brings up the Install Packages Window. In the blank Packages box type in the desired package and click Install.
This will take a few seconds to successfully read in but will allow you to use all of what the package can offer.
Here's what the code looks like.