Buffers & Convex Hulls

Buffers & Convex Hulls

An analysis common to modern population genetics is that of finding ecological distances between objects on a landscape.  The estimation of pairwise distance derived from spatial data is a computationally intensive thing, one that if you are not careful will bring your laptop to its knees!  One way to mitigate this data problem is to use a minimal amount raster area so that the estimation of the underlying distance graph can be done on a smaller set of points.  This example provides a simple solution using convex hulls.  Jump below for the complete example.

Read more

Raster Plotting

Raster Plotting

A raster is essentially an image, whose pixel size correspond to a particular spatial extent and the data contained within each pixel represents a particular feature on the landscape. Common rasters are DEM’s (measuring elevation), rainfall, temperature, buildings, etc. In R, it is common to think of rasters as matrices whose values measure some feature on the landscape. In this section, we will examine how to acquire, load, manipulate, and extract data from raster objects.

Read more

Extracting Data from Rasters

This document shows you how to extract data from rasters.

 

Getting The Libraries

First, I’ll load in some packages to get the ability to work with raster data and to load in the Arapatus attenuatus data set (it is part of the default gstudiopackage).

 

Loading and Cropping Rasters

We can load in the raster, and then crop it to just the are we need. These rasters were downloaded from [http://www.worldclim.org] and are much larger than the study area. This just makes it easier on the computer to not have to deal with such large areas. After cropping it, we will load in the annual precip and temperature data as well.

 

Getting Example Data from Araptus attenuatus

Now, lets grab the Araptus data and look at the data and plot out the locations.

 

 

png-3

Extracting Point Data

To elevation, temperature and precipitation from the rasters for each sampling location, we need to translate them into points first. I’ll first grab the coordinate data as a data.frame.

 

Then we can grab them using the normal functions in the sp library.

 

 

Plotting Trend lines.

Cool, lets sort this by latitude

 

and then plot out some values to look at what is going on.

png

 

png-1

 

png-2