ENGRG 59910 Introduction to GIS Michael Piasecki November 4, 2016 Lecture 10: Raster Analysis
ENGRG 59910Introduction to
GISMichael Piasecki
November 4, 2016
Lecture 10: Raster Analysis
GIS Related?
11/3/2016 ENGRG 59910 Intro to GIS 2
• In our previous discussion of data models, we indicated that Raster GIS is often used because:
• Raster is better suited for spatially continuous data like elevations• Raster is better for creating visualizations and modeling environmental phenomena
• Other continuous data may include: air pressure, temperature, salinity, etc..
• Raster data is a simplified realization of the world, and allows for fast and efficient processing
•A raster GIS performs geoprocessing tasks on a grid based realization of the world
11/3/2016 ENGRG 59910 Intro to GIS 3
Why we use Raster GIS
•Map Algebra Concept
• Typical Local Operation
• Typical Neighbor Operation• Moving Window (size, shape and margin erosion)• Common operations
• Typical Global Operation – Cost Distance
•Operations in ArcGIS• Spatial Analysis Environmental Setting• Toolbox
Outline Today
11/3/2016 ENGRG 59910 Intro to GIS 4
• Map algebra and raster GIS is quite simple to visualize in a spread sheet. An example of multiplication and addition
• The use of arrays make map algebra and raster GIS very computationally efficient
• But, be careful of:• Layers that are not coincident• Different cell sizes
11/3/2016 ENGRG 59910 Intro to GIS 5
Map Algebra
•Map algebra is a cell by cell combination of raster layers using mathematical operations
•Basic Mathematical Operations
• Addition, subtraction, division, max, min, virtually any mathematical operation you would find in an Excel spreadsheet
• Strong analytical functions
Map Algebra
11/3/2016 ENGRG 59910 Intro to GIS 6
• Some Map Algebra Commands in ARC/INFO• Outgrid = grid1 + grid2
• Outgrid = grid1 * 2
• Outgrid = sin(grid1)
• Outgrid = costallocation(sourcegrid, costgrid, accumgrid, backgrid)
• Outgrid = con(>5 (ingrid1),0,ingrid1)
• Outgrid = select(grid1, ‘VALUE = 10’)
• It is a simple syntax similar to any algebra
• Spatial Analysis language
•Developed by C. Dana Tomlin (1990)
• Implemented in many grid analysis packages, including ArcGIS, Idrisi, ArcView Spatial Analyst;
• The implementation in ArcGIS is “Raster Calculator”
• Four classes of operations:• Local, Focal, Zonal and Global
Map Algebra
11/3/2016 ENGRG 59910 Intro to GIS 7
Raster Calculator
11/3/2016 ENGRG 59910 Intro to GIS 8
Raster Operations
11/3/2016 ENGRG 59910 Intro to GIS 9
Local Operations
10
•Work on single cells, one after another, value assigned to a cell depends on this cell only
• Examples:• arithmetic operations with a constant, or with another grid• also logical operations, comparisons (min, max, majority, minority, variety, etc.) – same location but different layers
•Reclassification
11/3/2016 ENGRG 59910 Intro to GIS
Local Operations
11/3/2016 ENGRG 59910 Intro to GIS 11
•Assign data value to a cell based on its neighborhood (variously defined)
•Neighborhood: a set of locations each of which bears a specified distance and/or directional relationship to a particular location called the neighborhood focus (D. Tomlin)
• distance and directional neighbors• immediate and extended neighbors• metric and topological neighbors• neighbors of points, lines, areas...
12
Focal Operations
41
43 6
1
43 6
41
43 65 2
3 441
43 65 2
3 4
11/3/2016 ENGRG 59910 Intro to GIS 13
Define Neighborhoods: Shapes
• shape of neighborhood: | Circle | Rectangle | Doughnut | Wedge | Star
• size of neighborhood: radius (circle), inner and outer radius (doughnut), radius, start and end angles (wedge), width and height (rectangle)
•Operation: | Minimum | Maximum | | Mean | Median | Sum | Range | Standard Dev. | Majority | Minority | Variety |
11/3/2016 ENGRG 59910 Intro to GIS 14
Neighborhood Statistics in Spatial Analyst
Moving Window:
A “window”: cells used to specify the input values for an operation.
11/3/2016 ENGRG 59910 Intro to GIS 15
Define Neighborhood: Moving Window
Focal Operations
11/3/2016 ENGRG 59910 Intro to GIS 16
Example of mean kernel
11/3/2016 ENGRG 59910 Intro to GIS 17
GIS Solution to Margin Erosion
Neighborhood Operations
11/3/2016 ENGRG 59910 Intro to GIS 18
• smoothing ‐ moving averaging
• edge detection
•Grade (slope)
•Orient (aspect)
• Profile
•High pass filter
• assessing variety, etc.
11/3/2016 ENGRG 59910 Intro to GIS 19
Neighborhood Operations
Noise Highlight (high‐pass filter)
11/3/2016 ENGRG 59910 Intro to GIS 20
Noise Reduction (low‐pass)
11/3/2016 ENGRG 59910 Intro to GIS 21
Spatial Filtering ‐ Low and High Frequency Detail and Edges
11/3/2016 ENGRG 59910 Intro to GIS 22
High‐Pass filters emphasize high texture, low pass filters suppress, or minimize texture
543 Composite Result of ENVI 15x15 High Pass Filter – Edge Finding
Directional Edge Detection
11/3/2016 ENGRG 59910 Intro to GIS 23
Overlay functions in map algebra may be performed through addition and multiplication. Union operations with layer addition, clip operations through multiplication.
Union by addition:
Where cells don’t overlap (value + “no data”), new map unambiguous.
With overlap, attribute values are added, so be aware of consequences.
Overlay in Raster Map Algebra
11/3/2016 ENGRG 59910 Intro to GIS 24
Layer A values multiplied by 10
No ambiguous products
(LayerA * 10) + LayerB
11/3/2016 ENGRG 59910 Intro to GIS 25
•Make a new map of the area of interest with cell value = 1, others cell value = 0 or NODATA
•Multiply by existing map
Raster Clip
11/3/2016 ENGRG 59910 Intro to GIS 26
Common Raster Command: CON
11/3/2016 ENGRG 59910 Intro to GIS 27
•Con: Condition, a command in ArcGISIf (layer1>5) then
Output = 1else
Output = 0End if
Nested Con operation:Con(layer1>5, Con(Layer1>10,2,1), 0)
Con(layer1>5, 1, 0)
If (layer1>5) thenif (layer1>10) then
output = 2else
output =1end if
Elseoutput = 0
End if
0 0 1
0 2 0
0 0 0
CON is used for reclassfication
11/3/2016 ENGRG 59910 Intro to GIS 28
•Contain the minimum cost of reaching cells in a layer from one or more source cells.
• The cost may be expressed in different units: $ money, time, or other units of merit.
•Cost = distance * cost per unit of distance (frication surface)• The distance from a source cell is combined with a cost per unit of distance (variable or fixed) to calculate a travel cost.
• Think simple: Distances—in cell dimension units— are measured to/from cell centers and calculated using RMS formulae that keep values positive.
Cost Surfaces – Global Operation
11/3/2016 ENGRG 59910 Intro to GIS 29
• Another way to calculate travel costs• Cell values of a “friction” surface represent the (variable) cost
per unit travel distance for crossing each cell.• Define cell friction on elevation, land cover, etc. (or even friction:
icy slopes!)
Friction Surface: Cost per unit Distance
11/3/2016 ENGRG 59910 Intro to GIS 30
Cost Surface: varied cost
11/3/2016 ENGRG 59910 Intro to GIS 31
Land Use Friction or Cost Explanation
Agriculture 1 Base Cost
Deciduous Forest 4 Cut trees, removed and sold
Coniferous Forest 5 Cut trees, less return
Urban 1200 Conversion very expensive
Pavement 1 Base CostSuburban 1000 See UrbanBarren/Gravel 1 Base Cost
Cost of a new power line
11/3/2016 ENGRG 59910 Intro to GIS 32
Existing Trunk Power line
Cost Surface
11/3/2016 ENGRG 59910 Intro to GIS 33
Types of Raster Analysis
•Math•Distance • Surface analysis• Extraction•Water‐based analysis•Change cell values• Statistical Analysis•Conditional•Weighted overlay
11/3/2016 ENGRG 59910 Intro to GIS 34
•Map comparison is easily facilitated using the Tabulate Area function in ArcGIS (or any decent raster based GIS)
• Determines the cross tabulation between two grid themes on a cell‐by‐cell basis
•Once the tabulations are made, the data is displayed in a simple matrix
• Map one is the X axis and Map two is the Y axis
Comparing Two Maps
11/3/2016 ENGRG 59910 Intro to GIS 35
• Assume we have a 9 cell land cover map from 1990 with three categories: A, B, and C. We also have another map from 2000.
• You can see that the resulting cross tabulation provides a pixel by pixel comparison of the interpreted land cover types with the reference land cover. So, for the upper right hand cell, the 1990 data was B, and the 2000 data was also B. Therefore, this is a match between the two data sets. However, in the lower right cell you can see that the 1990 data indicated a value of C and the 2000 data set had a value of B
• We can now quantify the results into a matrix as shown below.
A BA
B C C
A A B
B BA
B B C
B A C
CrossTabulate
1990 2000
BA BBAA
BB BC CC
BA AA CB
Cross Tabulated Grid
2 02
0 2 1
0 1 1
A B CAB C
11/3/2016 ENGRG 59910 Intro to GIS 36
Cross Tabulation
• The matrix on the right shows the comparison of two hypothetical data sets. The 1990 data set represents the land use in 1990, while the 2000 data set represents the land use in 2000
• As an example, geographic features that were A in 2000, and were A in 1990, represent the upper left hand matrix with the value 2 (there were two pixels that met this criteria). This means that 2 units in the overall map that was A in 1990, was also A in 2000. Similarly, the same exists for B and C. The diagonal represents areas that have not changed.
• But, there may have been times where in 1990 the value was A but in 2000, the value was B. In this case, the 2 represented in the top row of the matrix says that there are 2units of something we said was A in 1990 but is B in 2000
• We can begin to add these number up, by adding an additional row and column. But what do these numbers tell us?
2 02
0 2 1
0 1 1
A B CAB C
1990 Data
2000 Data
2 02
0 2 1
0 1 1
A B CAB C
1990 Data
2000 Data
2 5 2
4
3
2
5
11/3/2016 ENGRG 59910 Intro to GIS 37
• The bottom row tells us that there were two cells that were A in both 1990 and 2000, five cells that were B, and two cells that were C. The rightmost column tells us that there were four cells that were A in 2000, three cells as B, and 2 cells as C. Adding up the Diagonal cells says there were 5 cells where we actually got it right.
• So, the similarities is really a function of:– Total cells on the diagonal / total number of cells.
• (2 + 2 + 1) / (2 + 2 + 0 +0 + 2 + 1 + 0 + 1+1) = 5/9 = .55% agreement
• The change is 45%.• We can also dig deeper and look at A. In 1990 there were 2
A’s. But, by the time 2000 came around there were 4 A’s. The A’s doubled. But, at what cost:
• Well, A grew by replacing 2 B’s. Therefore, we can see that B lost some ground to A. Imagine a real world example of being able to say that as Developed land grew, it actually grew by replacing Forested land: that’s the power of evaluating a cross tabulation.
2 02
0 2 1
0 1 1
A B CAB C
1990
2000
2 5 2
4
3
2
5
11/3/2016 ENGRG 59910 Intro to GIS 38
•Define Extent in ArcGIS• Default is the intersection of your input data• Could be the union of input data• x, y coordinates for the bottom‐left and the top‐right corners.• Could use bookmark or data frame extent
Spatial Analysis Extent
11/3/2016 ENGRG 59910 Intro to GIS 39
Define Analysis Extent in ArcGIS
11/3/2016 ENGRG 59910 Intro to GIS 40
Solution: Resample one map (or both?), so layers have same cell size and are aligned
Incompatible Cell Sizes
11/3/2016 ENGRG 59910 Intro to GIS 41
Analysis Mask
42
• You can specify a processing mask (either a raster or vector layer) to identify cells that will be set to NoData in the output.
Input Raster Analysis Mask Output Raster
11/3/2016 ENGRG 59910 Intro to GIS
A tour of raster functions in ArcGIS
11/3/2016 ENGRG 59910 Intro to GIS 43
•Raster processing extension to ArcGIS
• It has tools for performing a broad variety of spatial analyses, and is especially well‐suited to surface analysis.
•Used to• Create Data• Identify Spatial Relationships• Locate Suitable Sites• Execute sophisticated Path‐finding
•Comprehensive modeling and raster analysis capabilities
•Requires separate license from ESRI than ArcGIS
ArcGIS Spatial Analyst Extension
11/3/2016 ENGRG 59910 Intro to GIS 44
• Convert vector features (point, line, or polygon) to grids
• Calculate distance from every cell to objects of interest (similar to buffers)
•Generate density maps from point features
• Create continuous surfaces from scattered point features
•Derive contour, slope, aspect maps, and hillshades for these features
• Perform cell‐based map and discrete cell‐by‐cell analyses
• Simultaneously execute Boolean queries and algebraic calculations on multiple raster layers
• Perform neighborhood and zone analysis
• Perform raster classification and display
•Use data from different image formats
Spatial Analyst capabilities
11/3/2016 ENGRG 59910 Intro to GIS 45
Spatial Analyst Toolbar
11/3/2016 ENGRG 59910 Intro to GIS 46
•ArcGIS Desktop Help (local computer)•ArcGIS Desktop Resource Center (ESRI website)
Quick Check Spatial Analyst
11/3/2016 ENGRG 59910 Intro to GIS 47
• Keep working on your Project!
•After Thx‐giving no more Assigned Labs!
‐> instead, work even harder on your project
Remember
11/3/2016 ENGRG 59910 Intro to GIS 48