1
Raster Data
Analysis
UMESH BHURTYAL
KATHMANDU UNIVERSITY
Content 2
Elements in raster data model
Type of raster data
Raster data structure
Data conversion
Local operations
Neighborhood operations
Zonal operations
Physical distance measurement operations, other raster data
operations,
Comparison of vector and raster based analysis,
Shortest path analysis, least cost analysis
Elements of Raster Data Model 3
Cell value. Each cell in a raster carries a value, which
represents the characteristic of a spatial phenomenon at
the location denoted by its row and column. The cell
value can be integer or floating-point.
Cell size. The cell size determines the resolution of the
raster data model.
Raster bands. A raster may have a single band or
multiple bands.
Spatial reference. Raster data must have the spatial
reference information so that they can align spatially with
other data sets in a GIS.
Types of Raster Data 4
1. Satellite Imagery
2. Digital Elevation Models (DEMs)
3. Digital Orthophotos (DOQ)
4. Bi-Level Scanned Files (Image data that is composed of 1 bit per
pixel)
5. Digital Raster Graphics (DRGs)
6. Graphic Files
7. GIS Software-Specific Raster Data
Raster data structure 5
1. Cell-by-Cell Encoding
2. Run Length Encoding
3. Quad Tree
Raster Data Analysis 6
Raster data analysis is based on cells and rasters.
Raster data analysis can be performed at the level of individual
cells, or groups of cells, or cells within an entire raster.
Some raster data operations use a single raster; others use two or
more rasters.
Raster data analysis also depends on the type of cell value (numeric
or categorical values)
Raster data are particularly suited to certain types of analyses, such as basic geoprocessing,
surface analysis and terrain mapping.
Raster data can simplify many types of spatial analyses that would otherwise be overly cumbersome to
perform on vector datasets
Map Algebra 7
cell-by-cell combination of raster data layers
The combination entails applying a set of local and neighborhood
functions, and to a lesser extent global functions, to raster data.
Unary operations apply to one data layer.
Binary operations apply to two data layers, and higher-order operations
may involve many data layers.
a. Outlayer = Inlayer * 2
b. Sumlayer = LayerA + LayerB
Scale of Analysis 8
Raster analyses can be undertaken on four different scales of
operation:
local,
Neighborhood/focal,
zonal, and
global.
Local Operations: Single Layer 9
Given a single raster as the input, a local operation computes each
cell value in the output raster as a mathematical function of the cell
value in the input raster.
Arithmetic, logarithmic, trigonometric, and power
functions for local operations.
Local Operations: Single Layer 10
A local operation can convert a slope raster from percent (a) to degrees (b).
To convert, use this percent to degrees formula: With a slope percentage of 43%, degrees would be:
-1
Degrees = Tan-1 (Slope Percent/100) Degrees = Tan (.43)
Calculated out this gives an angle of 23.27 degrees.
Local Operations: Multiple Rasters 11
A common term for local operations with multiple input rasters is map
algebra, a term that refers to algebraic operations with raster map
layers.
Besides mathematical functions that can be used on individual rasters,
other measures that are based on the cell values or their frequencies
in the input rasters can also be derived and stored on the output raster
of a local operation with multiple rasters.
The cell value in (d) is the mean calculated from
three input rasters (a, b, and c) in a local operation.
The shaded cells have no data.
Local Operations: Multiple Rasters 12
Calculations performed between identical raster cells, that cell A1 (in the sense of a
Cartesian coordinate system) on the input raster is compared to cell A1 on the comparison
raster, B1 to B1, etc.
Focal/Neighborhood Operation 13
Tobler’s first law of geography states that
“everything is related to everything else,
but near things are more related than
distant things.”
Neighborhood operations represent a
group of frequently used spatial analysis
techniques that rely heavily on this
concept.
A neighborhood operation involves a
focal cell and a set of its surrounding cells.
The surrounding cells are chosen for their
distance and/or directional relationship to
the focal cell.
Common neighborhoods include
Four common neighborhood types: rectangle (a), circle (b),
rectangles, circles, annuluses, and annulus (c), and wedge (d). The cell marked with an x is the
wedges. focal cell.
Neighborhood Operation 14
The cell values in (b) are the neighborhood
means of the shaded cells in (a) using a 3 x 3
neighborhood. For example, 1.56 in the output
raster is calculated from (1 +2 +2 +1 +2 +2 +1 +2
+1) / 9.
Neighborhood Operation 15
The cell values in (b) are the neighborhood
range statistics of the shaded cells in (a) using
a 3 x 3 neighborhood. For example, the upper-
left cell in the output raster has a cell value of
100, which is calculated from (200 – 100).
The most typical neighborhood is 3 by 3 cells, which
incorporates the processing cell and its closest eight
neighbors.
Neighborhood Operation 16
The cell values in (b) are the neighborhood
majority statistics of the shaded cells in (a) using
a 3 x 3 neighborhood. For example, the upper
left cell in the output raster has a cell value of 2
because there are five 2s and four 1s in its
neighborhood.
Neighborhood Operation 17
Raster analyses employ moving windows, also called filters or kernels,
to calculate new cell values for every location throughout the raster
layer’s extent.
are commonly used for data simplification on raster datasets
can be used to exaggerate differences in a dataset
We can say :
Focal, or neighborhood, operations produce an output raster dataset in
which the output value at each cell location is a function of the input
value at a cell location and the values of the cells in a specified
neighborhood around that location.
Zonal Operation 18
A zonal operation works with groups of cells of same values or like
features. These groups are called zones. Zones may be contiguous
or noncontiguous.
A zonal operation may work with a single raster or two rasters.
Given a single input raster, zonal operations measure the geometry
of each zone in the raster, such as area, perimeter, thickness, and
centroid.
Given two rasters in a zonal operation, one input raster and one
zonal raster, a zonal operation produces an output raster, which
summarizes the cell values in the input raster for each zone in the
zonal raster.
Zonal Operation 19
The cell values in (c) are the zonal means derived
from an input raster (a) and a zonal raster (b). For
example, 2.17 is the mean of {1, 1, 2, 2, 4, 3} for zone
1.
Zonal operations and analyses are valuable in fields of
study such as landscape ecology where the geometry and
spatial arrangement of habitat patches can significantly
affect the type and number of species that can reside in
them.
zonal analyses can effectively quantify the narrow
habitat corridors that are important for regional
movement of flightless, migratory animal species
moving through otherwise densely urbanized areas.
Global Operations 20
Global operations are similar to zonal
operations whereby the entire raster
dataset’s extent represents a single
zone.
include determining basic statistical
values for the raster as a whole. For
example, the minimum, maximum,
average, range, and so forth can be
quickly calculated over the entire
extent of the input raster and
subsequently be output to a raster in
which every cell contains that
calculated value
PHYSICAL DISTANCE MEASURE 21
OPERATIONS
distances may be expressed as
physical distances or cost distances
Physical distance measures the straight-line or Euclidean distance,
whereas the cost distance measures the cost for traversing the
physical distance
Example: truck driver, for example, is more interested in the time or
the fuel cost for covering a route than in its physical distance
cost distance in this case is based on not only the physical
distance but also the speed limit and road condition
PHYSICAL DISTANCE 22
A straight-line distance is measured from a cell center to another
cell center. This illustration shows the straight-line distance between
cell (1,1) and cell (3,3).
cell size × √(3 − 1)²+ (3 − 1) ²
or cell size × 2.828. If the cell size were 30 meters,
the distance would be 84.84 meters.
A straight-line distance is measured from a cell center
to another cell center. This illustration shows the
straight-line distance between cell (1,1) and cell (3,3).
A physical distance measure operation essentially buffers the source cells with wavelike
continuous distances over the entire raster. Continuous distance measures from a
stream network.
Allocation and Direction 23
Based on the source cells denoted as 1 and 2, (a) shows the physical distance measures in cell units
from each cell to the closest source cell; (b) shows the allocation of each cell to the closest source cell;
and (c) shows the direction in degrees from each cell to the closest source cell. The cell in a dark
shade (row 3, column 3) has the same distance to both source cells. Therefore, the cell can be
allocated to either source cell. The direction of 243° is to the source cell 1.
The direction values are based on the compass directions: 90° to the east, 180° to the south, 270° to the west, and 360° to
the north. (0° is reserved for the source cell.)
Clip 24
An analysis mask (b) is used to clip an input raster (a). The output
raster is (c), which has the same area extent as the analysis mask.
Clip 25
Other raster data operations 26
Mosaic
A mosaic is a combination or merge of two or more images. In GIS, you
can create a single raster dataset from multiple raster datasets by
mosaicking them together.
These overlapping areas can be handled in several ways; for example, you can choose to only keep
raster data from the first or last dataset, you can blend the overlapping cell values using a weight-
based algorithm, you can take the mean of the overlapping cell values, or you can take the minimum or
maximum value.
Mosaic 27
When mosaicking discrete data, the First, Minimum, or Maximum options
give the most meaningful results.
The Blend and Mean options are best suited for continuous data. If any of
the input rasters are floating point, the output is floating point.
If all the inputs are integer and First, Minimum, or Maximum is used, the
output is integer.
Other key points about mosaicking raster data include the following:
A raster dataset that has been created from mosaicking has the same schema
as any other raster dataset.
All the raster datasets and the output raster mosaic must have the same
number of bands; otherwise, the mosaic cannot be created.
If two or more rasters have the same spatial reference and the same pixel size,
they can be mosaicked into a single raster.
If the second raster has a different spatial reference from the first raster
dataset, the spatial reference of the second raster dataset will be ignored and
its data transformed into the spatial reference of the first raster dataset. In this
case, it is recommended that you use the Project Raster tool to ensure that
your data is not compromised.
Mosaic Operators 28
The Minimum method determines
the lower pixel value from the two
raster datasets that are
The First method determines overlapping.
the pixel value from the first
raster dataset in the mosaic
list. The existing raster dataset
is considered first.
The Maximum method determines
the higher pixel value from the two
raster datasets that are
The Last method determines the overlapping.
pixel value from the last raster
dataset that is overlapping. This
is the fastest method available
and also the default. The Sum method determines the total
value of all the pixels added together
from the overlapping raster datasets.
Mosaic to New Raster 29
30
1st Raster
Mosaic
2nd Raster
Extract By Mask 31
32
Mosaic Raster
Masking Polygon
Extract By Mask
Aggregate 33
A generalization operation that produces an output raster with a larger cell size
(i.e., a lower resolution) than the input raster.
An Aggregate operation creates a lower-resolution raster
(b) from the input (a). The operation uses the mean statistic
and a factor of 2 (i.e., a cell in b covers 2-by-2 cells
in a). For example, the cell value of 4 in (b) is the mean
of {2, 2, 5, 7} in (a).
Comparison of vector and raster 34
based analysis
“raster is faster, but vector is corrector”
Each of these models has its own advantages and disadvantages
Comparison of vector and raster 35
based analysis
raster-based overlay is often preferred for projects that involve a
large number of layers and a considerable amount of computation
First, to combine the geometries and attributes
Second, a raster-based local operation has
from the input layers, a vector-based overlay
access to various tools and operators to create
operation must compute intersections between
the output whereas a vector-based overlay
features and insert points at the intersections. This
operation only combines attributes from the input
type of computation is not necessary for a raster-
layers.
based local operation because the input rasters
have the same cell size and area extent.
Comparison of vector and raster 36
based analysis
An overlay operation can combine multiple attributes from each
input layer. Once combined into a layer, all attributes can be
queried and analyzed individually or in combination.
For example, a vegetation stand layer can have the attributes of
height, crown closure, stratum, and crown diameter, and a soil layer
can have the attributes of depth, texture, organic matter, and pH
value.
An overlay operation combines the attributes of both layers into a
single layer and allows all attributes to be queried and analyzed.
a raster-based local operation would require one raster for each
attribute
vector-based overlay operation is therefore more efficient than a raster-based local operation if the
data sets to be analyzed have a large number of attributes that share the same geometry.
Comparison of vector and raster 37
based analysis
vector-based buffering
operation and a raster based
physical distance measure
operation are similar in that they
both measure distances from
select features
a buffering operation uses x- and
y-coordinates in measuring
distances, whereas a raster-
based operation uses cells in
measuring physical distances
buffering operation can
therefore create more accurate
buffer zones than a raster-based
operation can
Reclassify Raster 38
• Simplify data
• Generalize data
• Easy interpretation of data
• Setting specific values to
NoData or setting NoData
cells to a value
NDVI
Reclassified
Reclassify Raster 39
40
Reclassification Based on
Symbology
Raster Reclassify 41
Reclassify raster 42
Reclassify raster 43
[Link] datasets. Decide which datasets
you need as inputs. 44
[Link] datasets. When applicable, create
the datasets that you can derive from your
base input datasets— for example, slope
and aspect can be derived from the
elevation raster. Create data from existing
data to gain new information.
[Link] or rescale datasets Reclassify
each dataset to a common scale (for
example, 1 to 10), giving higher values to
more suitable attributes.
[Link] and combine datasets. Weight
datasets that should have more influence
in the suitability model if necessary, then
combine them to find the suitable locations.
derived datasets are slope, distance to recreation sites, and distance to existing schools.
Weighted Site Selection Example 45
Weights are assigned as different percentages that must add up to 100%.
weighted site selection Problem: locating the best site for a new business
such as a vineyard
factors : be slope, elevation, sun exposure and distance to major freeways
conducting a weighted site selection analysis all of these will be ranked
based on their overall importance
sun exposure could be weighted as 40% because grapes will not grow
properly with too little or too much sun. Slope is 30% while elevation would
be 20% because if the vineyard is too high, the temperatures will be too
cold and there could be too much moisture for the grapes. Distance to
freeways would be 10% because although important for visitors, without
the right growing conditions there could be no vineyard at all.
To sum up 46
Local raster operations examine only a single target cell during
analysis.
Neighborhood raster operations examine the relationship of a target
cell proximal surrounding cells.
Zonal raster operations examine groups of cells that occur within a
uniform feature type.
Global raster operations examine the entire areal extent of the
dataset.