How to define projections and reproject spatial data
September 30, 2016
This R Tip uses code that was modified from homework assignments for the graduate class, Spatial Ecology For/FW 870 at Michigan State University.
When plotting spatial data on a map, your shapefile and spatial occurrence data must have the same map projection or your map will appear distorted. Map projections account for the spheroid shape of the earth when projecting data onto a flat (map) surface. One of the most common projections is WGS 1984 (World Geodetic Survey 1984) using the WGS 1984 spheroid. This projection uses certain latitudinal and longitudinal coordinates to link a spheroid to a portion of the earth’s surface.
To find the projection of a raster or shapefile, you can use the command
The projection for the Oregon shapefile is GRS80.
We can change the projection to match some data that we would like to plot over the Oregon shapefile. For example, we might like to plot spotted owl occurrences in Oregon. We need to check the projection of spotted owl data and change the projection of the owl data so that it matches the shapefile. To do this, we first define the projection of the owl data.
We then can reproject the spotted owl data by copying and pasting the projection output from the command
Now we can plot the spotted owl occurrences over the Oregon shapefile.