ENGRG 59910 Introduction to  GIS Michael Piasecki November 4, 2016 Lecture 10: Raster Analysis

GIS Related?

11/3/2016

ENGRG 59910 Intro to GIS

2

Why we use Raster GIS • 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

Outline Today • 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

11/3/2016

ENGRG 59910 Intro to GIS

4

Map Algebra • 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

• Some Map Algebra Commands in ARC/INFO

Map Algebra

• Outgrid = grid1 + grid2 • Outgrid = grid1 * 2 • Outgrid = sin(grid1) • Outgrid = costallocation(sourcegrid, costgrid, accumgrid, backgrid)

• Map algebra is a cell by cell  combination of raster  layers using mathematical  operations • Basic Mathematical  Operations

• Outgrid = con(>5 (ingrid1),0,ingrid1) • Outgrid = select(grid1, ‘VALUE = 10’)

• Addition, subtraction,  division, max, min, virtually  any mathematical  operation you would find in  an Excel spreadsheet

• Strong analytical functions

11/3/2016

ENGRG 59910 Intro to GIS

6

Map Algebra • 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

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

• 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

10

Local Operations

11/3/2016

ENGRG 59910 Intro to GIS

11

Focal Operations

• 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

Define Neighborhoods: Shapes

1

1 3 4 6 4

3

5 1 2 3 4 6 3 4 4

5 1 2 3 4 6 3 4 4

11/3/2016

6 4

ENGRG 59910 Intro to GIS

13

Neighborhood Statistics in Spatial Analyst • 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

Define Neighborhood: Moving Window Moving Window: A “window”: cells used to  specify the input values for  an operation.

11/3/2016

ENGRG 59910 Intro to GIS

15

Focal Operations

11/3/2016

ENGRG 59910 Intro to GIS

16

GIS Solution to Margin Erosion Example of mean kernel

11/3/2016

ENGRG 59910 Intro to GIS

17

Neighborhood Operations

11/3/2016

ENGRG 59910 Intro to GIS

18

Neighborhood Operations • 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

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

543 Composite Result of ENVI 15x15 High Pass Filter – Edge Finding High‐Pass filters emphasize high texture, low pass filters suppress, or  minimize texture  11/3/2016

ENGRG 59910 Intro to GIS

22

Directional Edge  Detection

11/3/2016

ENGRG 59910 Intro to GIS

23

Overlay in Raster Map Algebra 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.

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

Raster Clip • Make a new map of the area of interest with cell value = 1, others cell  value = 0 or NODATA • Multiply by existing map

11/3/2016

ENGRG 59910 Intro to GIS

26

Common Raster Command: CON •Con: Condition, a command in ArcGIS If (layer1>5) then Output = 1 else Output = 0 End if

Con(layer1>5, 1, 0)

Nested Con operation: Con(layer1>5, Con(Layer1>10,2,1), 0)

0

0

1

0

2

0

0

0

0

If (layer1>5) then if (layer1>10) then output = 2 else output =1 end if Else output = 0 End if 11/3/2016

ENGRG 59910 Intro to GIS

27

CON is used for reclassfication

11/3/2016

ENGRG 59910 Intro to GIS

28

Cost Surfaces – Global Operation • 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.

11/3/2016

ENGRG 59910 Intro to GIS

29

Friction Surface: Cost per unit Distance • • •

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!)

11/3/2016

ENGRG 59910 Intro to GIS

30

Cost Surface: varied cost

11/3/2016

ENGRG 59910 Intro to GIS

31

Cost of a new power line 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 Cost

Suburban

1000

See Urban

Barren/Gravel

1

Base Cost

11/3/2016

ENGRG 59910 Intro to GIS

32

Cost Surface

Existing Trunk Power line 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

Comparing Two Maps • 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

11/3/2016

ENGRG 59910 Intro to GIS

35

Cross Tabulation 1990

2000

A

B

B

B

B

C

B

A

C

Cross Tabulate

Cross Tabulated Grid

A

A

B

B

C

C

A

A

B

AA

BA

BB

BB

BC

CC

BA

AA

CB

A B C A B C

2

2

0

0

2

1

0

1

1

• 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.  11/3/2016

ENGRG 59910 Intro to GIS

36









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

1990 Data A B C

A 2 2 0 As an example, geographic features that were 2000 Data B 0 2 1 A in 2000, and were A in 1990, represent the C 0 1 1 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. 1990 Data 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 2 units of something we said was A in 1990 but is B in 2000

A B C 2000 Data A B C

2

2

0

4

0

2

1

3

0

1

1

2

2

5

2

5

We can begin to add these number up, by adding an additional row and column. But what do these numbers tell us?

11/3/2016

ENGRG 59910 Intro to GIS

37





The bottom row tells us that there were two cells that 1990 were A in both 1990 and 2000, five cells that were B, A B C and two cells that were C. The rightmost column tells A 2 2 0 us that there were four cells that were A in 2000, 0 2 1 2000 B three cells as B, and 2 cells as C. Adding up the C 0 1 1 Diagonal cells says there were 5 cells where we 2 5 2 actually got it right.

4 3 2 5

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.

11/3/2016

ENGRG 59910 Intro to GIS

38

Spatial Analysis Extent • 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

11/3/2016

ENGRG 59910 Intro to GIS

39

Define Analysis Extent in ArcGIS

11/3/2016

ENGRG 59910 Intro to GIS

40

Incompatible Cell Sizes

Solution: Resample one map (or both?), so layers have same cell size and are  aligned 11/3/2016

ENGRG 59910 Intro to GIS

41

Analysis Mask • 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

11/3/2016

Analysis Mask

ENGRG 59910 Intro to GIS

Output Raster

42

A tour of  raster  functions  in ArcGIS

11/3/2016

ENGRG 59910 Intro to GIS

43

ArcGIS Spatial Analyst Extension • 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

11/3/2016

ENGRG 59910 Intro to GIS

44

Spatial Analyst capabilities  • 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 

11/3/2016

ENGRG 59910 Intro to GIS

45

Spatial Analyst Toolbar

11/3/2016

ENGRG 59910 Intro to GIS

46

Quick Check Spatial Analyst • ArcGIS Desktop Help (local computer) • ArcGIS Desktop Resource Center (ESRI  website)

11/3/2016

ENGRG 59910 Intro to GIS

47

Remember • Keep working on your Project! • After Thx‐giving no more Assigned Labs! ‐> instead, work even harder on your project

11/3/2016

ENGRG 59910 Intro to GIS

48