Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning R for Geospatial Analysis

You're reading from   Learning R for Geospatial Analysis Leverage the power of R to elegantly manage crucial geospatial analysis tasks

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher Packt
ISBN-13 9781783984367
Length 364 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Michael Dorman Michael Dorman
Author Profile Icon Michael Dorman
Michael Dorman
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. The R Environment FREE CHAPTER 2. Working with Vectors and Time Series 3. Working with Tables 4. Working with Rasters 5. Working with Points, Lines, and Polygons 6. Modifying Rasters and Analyzing Raster Time Series 7. Combining Vector and Raster Datasets 8. Spatial Interpolation of Point Data 9. Advanced Visualization of Spatial Data A. External Datasets Used in Examples
B. Cited References
Index

Subsetting rasters

In many situations, we would like to access the values of a given raster either to perform calculations involving these values (for example, to calculate a frequency table) or to make an assignment (for example, to change a certain value in the raster; see the previous code section in Chapter 1, The R Environment). In this section, we are going to cover the different ways to do this.

As an example, we are going to use another multiband raster, modis.tif. First, we will assign it to a RasterBrick object named r and print its properties, as follows:

> r = brick("C:\\Data\\modis.tif")
> r
class       : RasterBrick
dimensions  : 100, 100, 10000, 280  (nrow, ncol, ncell, nlayers)
resolution  : 500, 500  (x, y)
extent      : 660000, 710000, 3445000, 3495000  (xmin, xmax, ymin$
coord. ref. : +proj=utm +zone=36 +datum=WGS84 +units=m +no_defs +$
data source : C:\Data\modis.tif
names       : modis.1, modis.2, modis.3, modis.4, modis.5, modis.$

The modis.tif file contains...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image