# Section Three - Raster Data

Second in our list of spatial data types is raster data.  In reality, raster data is any pixel-based picture data (JPG, PNG, TIFF for example) which is loaded into the software.   Both a picture of your cat Mogwai and a DEM are seen as raster data by the software, however, what sets spatial raster data apart is the data which accompanies it. Since we know what makes GIS unique in comparison to paper-based map analysis is the ability to join and analyze both the spatial and the non-spatial, the ability to attach numeric data to raster images is a powerful tool in our GIS toolbox.

All digital images are comprised of a series of pixels, or digital squares, arranged in a grid pattern. You may have seen the pixels of an image before when you try to post an picture to your social media account that was once a small sized picture and you’re trying to make it display full page. We would describe the image as pixelated, or the fact that the image pixels have become so large, that the only thing you can see is the pixel makeup of the image and not the image itself.  Kind of like the cliche "you can't see the forest because of the trees", meaning that you cannot see the entire forest if you are so close, you can only see the trees.

Figure 3.6: A Pixelated Version of the Mona Lisa
In this image, we can see all the pixels a digital version of the Mona Lisa is made up of. Notice the pixels are all squares in a grid pattern.

The properties of raster data is what makes the unique compared to vector data.  We learned that vector data is data is just a graphical representation of objects using vertices connected by straight lines to outline an area (polygons), mark the location of a single instance (points), or trace along linear objects (polylines).  Because we can place a vertex really anywhere we want in the software, there are no "rules" about vector data beyond the vertex minimums to create points, polylines, or polygons.  Vertices can be placed very close together or very far apart.  They can be moved and deleted freely, and new vertices can be added to any vector feature (a single object stored in the larger shapefile or feature class) at any interval at any time.  Rasters, however, have very strict rules.  Each pixel is a defined size, both in height and width, and because each pixel is a square, by default, the center-to-center measurement, that is from the center of one pixel to the center of his direct neighbor (in straight lines, not diagonal), will be equal.  You cannot delete pixels, but you can hide them from view, making them transparent.  You can cut out smaller rasters from larger ones, or create a subset raster, or you can join two or more rasters together to create a larger raster in a process called mosaicing, but that is pretty much it.  We can run geoprocessing tools on rasters, creating new rasters by examining the properties of the non-spatial data, but even that process doesn't destroy or modify the original raster.

Figure 3.7: Raster Properties
All rasters are a series of pixels arranged in rows and columns, each with an equal height, width, and center-to-center value.

The beauty of these strict raster rules is the fact that assumptions can be made about spatial rasters that cannot be made about vectors.  Since each pixel is a perfect square, we can measure the distance on the Earth's surface that is covered by that raster, basically using the edge of a raster pixel as a ruler.  This is called the raster's spatial resolution, and it's one of several assumptions we can make.  When we see an image of an area in a 30 meter spatial resolution raster, we know - for a fact - that the side of each pixel covers exactly 30 meters on the ground.  Since we know the distance each spatial raster covers over the distance of one pixel, we can measure distances and use geoprocessing tools to infer distribution and relationship properties.

All rasters have some data attached to them, such as the RGB - or red-green-blue - values which tell the computer monitor how to display a color image.  Many images even have some geospatial-type data attached, such as geotagged images in Facebook or Instagram.  For the same reasons Instagram "knows" where an image is in the world, geospatial rasters know where to plot themselves in GIS software - the metadata.  Metadata, as we will learn in more detail in Chapter Eight, is the data about the data.  Any information about a raster or a vector file which describes the file, who took the picture, where the picture was taken, when the picture was taken, etc, is considered the metadata.

Even though a picture of your cat is technically a raster (as raster is another word borrowed by GIS and used in many other computer-based sciences and arts), what sets spatial rasters apart from a picture of Angry Cat is the attached non-spatial data.  Metadata, the data about the data, is reserved more for facts about the image and not data associated with the image.  In addition to having RGB values, like all rasters, geospatial rasters have "super geotagging", meaning that every pixel "knows" exactly where in the world it lives.  Each corner of each pixel has a stored geographic or projected coordinate pair, making the image georeferenced, or defining and storing very specific location data about the image.

But non-spatial data for rasters doesn't stop with the exact location, but goes on to include a whole array of information, such as the average elevation of the place on Earth depicted in each pixel (sometimes called cell), information about what is living or built on the Earth's surface within that pixel, or categorized information about what the pixel represents.

### 3.3.2: Classification Rasters

While many rasters are images, sometimes we can use classification rasters, or rasters made up of integer values which, instead of showing an actual captured image of what is on the Earth's surface, they show a colored-in picture of what the pixel represents. To classify the image, the software considers the attribute, such as water, land, building, etc., then decides how much of the cell is that item. If it is a mixed pixel, or a pixel that has two or more items in it, the software will use a decision making process to decide what to classify, or “name”, the cell. For example, if the cell is 50% or more water, the tool will classify it as water.

GIS 101 really focuses on learning GIS software using vector data, but it's important to understand the properties of raster data.

Figure 3.8: The Classification of Raster Images
Satellite Image of a CoastlineClassification ResultClose-up of Classification ResultRaster Values Exposed

### 3.3.3: Recognizing Raster Data

In the vector section of the reading, we noted that when we look at spatial data in the GIS, the file icons associated with each vector file are a key to recognizing what the geometry type is (based on the decoration of the icon) and if the file is a shapefile or a feature class (green vs blue).  Raster data is no different, the software provides us with file icons to recognize if a file is a raster file and where the raster is stored.

For both rasters stored inside a geodatabase and those stored inside a folder, the icon is the same - a small grid with twelve "pixels". Just a small representation of the basic raster structure.  Remember, all of these file icons can be looked up in the File Icon page on the wiki (link button in the top toolbar).

Figure 3.9: Raster Icons in ArcGIS Software
Rasters stored in a geodatabase have a blue raster structure looking icon.Raster images stored inside folders have a yellow file icon, with the same icon structure as the geodatabases raster icon.

### 3.3.4: Raster Types

Classification raster often have very specific names, like "Digital Elevation Models (DEM)", "Land Use", "Land Cover", "Hillshade", "Slope", or "Aspect", depending on what the coded value is showing.  Land use codes usually refer to what the area is used for - urban, farming, forest, etc, while land cover codes usually refer to what is the make-up of the pixel, such as water, snow, crops, grass, etc.  Aspect and slope rasters use colored values to express which way a mountain slope faces and how steep an area is, respectively.

#### Digital Elevation Model (DEM) Rasters

Digital Elevation Models or DEM is a special case of classification raster. These raster files hold fairly detailed information about the elevation changes in a landscape.  DEM Each pixel, whether it is 1, 10, or 30 meters (the common DEM sizes) stores the average elevation for the corresponding square on the Earth’s surface. As you can see, the higher the spatial resolution, or amount of ground covered by one pixel, the more accurate the elevation data. But, as you can imagine, the higher the spatial resolution, the more data it takes to store that information, and thus, the larger the storage device or the longer the time taken to download.

ArcGIS can process DEMs of all spatial resolutions, simply adjusting the accuracy of the resulting contour layer to fit the quality of the input. In most cases, however, 30 meter DEM data is more then enough to create and analyze spatial problems.

Figure 3.10: A Digital Elevation Model (DEM)
A digital elevation model is a raster which stores elevation data. From elevation, slope, aspect, and contour lines can all be derived mathematically.

A common product of a geoprocessing tool used on DEMs are shaded reliefs or hillshades which are a visual representation the DEM if the sun were to shine on it, shading the terrain facing away from the sun, and highlighting the areas of the terrain facing it. Hilllshades are most often used as base maps, an image which serves as a backdrop to vector and other raster data, and generally has little other use. They are basically the same product, it's just one uses shades of gray and the other uses shades of reds, greens, and yellows.

Hillshades express the relief of the topographic surface in a 2D image which has a 3D appearance using shades of gray.Shaded reliefs express the same relief using color.

#### Slope and Aspect Rasters

The last two common layers produced from DEMs are slope and aspect layers. From the elevation values stored in a DEM, slope and aspect can be derived.  Slope is how steep the grade of the topographic surface is over a defined area while aspect is the cardinal direction the slope faces.  The software examines the elevation values and calculates the slope and aspect based on the increase or decrease in value from one pixel to all eight of it's neighbors.  If there is a large decrease, the slope changes quickly; if there is a small decrease, the slope changes gradually.  Based on where the pixels show up slope and down slope, the software can calculate which cardinal direction(N, NE, E, SE, S, SW, W, NW) each slope faces. The slope and aspect tools found in ArcGIS utilize this data to create new output layers colored to represent this data in an understandable and meaningful way.

Figure 3.12: Slope and Aspect Layers
Slope is the grade of the topographic surface.Aspect is the cardinal direction of the slope. Both layers are derived mathematically by the GIS software using elevation values stored in DEMs.

### 3.3.4: Raster Pyramids

When you load raster data into ArcGIS, it will pose the question of whether or not you would like it to “build raster pyramids”. Okay, yeah, that sounds great, ArcGIS, but what is a raster pyramid?

Raster pyramids are several re-sampled, reduced resolution versions of the original data that allows you to work with raster data faster by only showing the low resolution images (longer ground distance per pixel edge) when you are zoomed out, and the higher resolution image when you are zoomed in.

The advantage of raster pyramids is a reduction of drawing time. When the software doesn’t need to draw fine-detail imagery when you are zoomed out, the software just works faster over all. Think back to the dial-up days, when your aunt would email a picture and you’d have to wait five minutes for it to load over that lightning fast connection. GIS software processes raster images much the same way, where we can equate a slow data connection with high resolution GIS images. Raster pyramids re-sample and store several images; each one will draw at cable internet speeds for a range of zoom levels - fine detail for a low zoom level (very close) and course detail for a high zoom level (very far away).

Raster pyramids are stored in an MXD (ArcMap specific save format, creating a map project document) for the exclusive use of drawing speed within that project only, and are not accessible for use in any way.

Figure 3.13: A Graphical Example of Raster Pyramid Creation
In this graphic, we can see the resampling of the raster pixels within the software. For every four pixels, in this example, the dominate color is found, then the next layer creates a pixel of that color. This process is repeated for each resampled layer.