Our book “Remote Sensing and GIS for Ecologists – Using Open Source software” is now available. First editor copies arrived already and it looks pretty good. Great to have finally a copy on our desks after all the writing, testing and editing! We hope that you enjoy it as much as we do and that it helps you working with remote sensing and GIS in your research topics.
You can order it here.
All practical examples in this book rely on OpenSource software and freely available data sets. Quantum GIS (QGIS) is introduced for basic GIS data handling, and in-depth spatial analytics and statistics are conducted with the software package R.
Readers will learn how to apply remote sensing within ecological research projects, how to approach spatial data sampling and how to interpret remote sensing derived products. We discuss a wide range of statistical analyses with regard to satellite data as well as specialised topics such as time-series analysis. Extended scripts on how to create professional looking maps and graphics are also provided.
This book is a valuable resource for students and scientists in the fields of conservation and ecology interested in learning how to get started in applying remote sensing in ecological research and conservation planning.
check the table of content here: http://book.ecosens.org/content/
Here we see three simple ways to perform an unsupervised classification on a raster dataset in R. I will show these approaches, but first we need to load the relevant packages and the actual data. You could use the Landsat data used in the “Remote Sensing and GIS for Ecologists” book which can be downloaded here.
# loading the layerstack
# here we use a subset of the Landsat dataset from "Remote Sensing and GIS for Ecologists"
image <- stack("path/to/raster")
Now we will prepare the data for the classifications. First we convert the raster data in a matrix, then we remove the NA-values.
## returns the values of the raster dataset and write them in a matrix.
v <- getValues(image)
i <- which(!is.na(v))
v <- na.omit(v)
The first classification method is the well-known k-means method. It separates n observations into k clusters. Each observation belongs to the cluster with the nearest mean.
## kmeans classification
E <- kmeans(v, 12, iter.max = 100, nstart = 10)
kmeans_raster <- raster(image)
kmeans_raster[i] <- E$cluster
The second classification method is called clara (Clustering for Large Applications). It work by clustering only a sample of the dataset and then assigns all object in the dataset to the clusters.
## clara classification
clus <- clara(v,12,samples=500,metric="manhattan",pamLike=T)
clara_raster <- raster(image)
clara_raster[i] <- clus$clustering
The third method uses a random Forest model to calculate proximity values. These values were clustered using k-means. The clusters are used to train another random Forest model for classification.
## unsupervised randomForest classification using kmeans
rf = randomForest(vx)
rf_prox <- randomForest(vx,ntree = 1000, proximity = TRUE)$proximity
E_rf <- kmeans(rf_prox, 12, iter.max = 100, nstart = 10)
rf <- randomForest(vx,as.factor(E_rf$cluster),ntree = 500)
The three classifications are stacked into one layerstack and plotted for comparison.
class_stack <- stack(kmeans_raster,clara_raster,rf_raster)
names(class_stack) <- c("kmeans","clara","randomForest")
Comparing the three classifications:
Looking at the different classifications we notice, that the kmeans and clara classifications have only minor differences.
The randomForest classification shows a different image.
The RStoolbox R package has been updated after some testing in courses and by colleagues. Please update your package using update.packages() or install the RStoolbox again.
New functions are:
- new function
validateMap() for assessing map accuracy separately from model fitting, e.g. after majority or MMU filtering
- new function
getValidation() to extract specific validation results of superClass objects (proposed by James Duffy)
- new spectral index NDVIc (proposed by Jeff Evans)
- new argument scaleFactor for
spectralIndices() for calculation of EVI/EVI2 based on scaled reflectance values
- implemented dark object subtraction radCor(..,method=’sdos’) for Landsat 8 data (@BayAludra, #4)
various changes were applied:
- superClass() based on polygons now considers only pixels which have their center coordinate within a polygon
- rasterCVA() now returns angles from 0 to 360° instead of 0:45 by quadrant (reported by Martin Wegmann and explained here)
- improved dark object DN estimation based on maximum slope of the histogram in
estimateHaze (@BayAludra, #4)
And some bugs fixed:
- superClass() failed when neither valData or trainPartition was specified. regression introduced in 0.1.3 (reported by Anna Stephani)
- spectralIndices() valid value range of EVI/EVI2 now [-1,1]
- radCor() returned smallest integer instead of NA for some NA pixels
- fix ‘sdos’ for non-contiguous bands in radCor (@BayAludra, #4)
We updated our cheatsheet on spatial data handling in R. Beside some minor changes of common raster commands we also added now some of the new RStoolbox commands within a Remote Sensing operations section such as the command for supervised classification, fractional cover analysis or cloud masking.
The R spatial data handling cheatsheet has been created to ease the use of relevant R commands and cen be downloaded as pdf.
We finally submitted our book “Remote Sensing and GIS for Ecologists” to the publisher. It took longer than anticipated and we learned a lot. Looking forward to the printed version.
More details how to order and the expected publishing date can be found at http://www.pelagicpublishing.com/remote-sensing-and-gis-for-ecologists.html
we will post news and updates about the book and its content at book.ecosens.org