Spatial Analysis Using Grids Learning Objectives By the end of this class you should be able to: describe some ways continuous surfaces or spatial fields are represented in GIS list and describe the data elements that comprise a grid data structure describe how integer, categorical and real valued data fields are represented using grids use map algebra to perform raster calculations on grids and explain the scale issues involved in raster calculations where grids may not have the same cell size define interpolation and describe aspects to be considered in interpolating a spatial field use interpolation to determine watershed average precipitation (Ex 3) calculate the slope of a topographic surface represented by a grid using: i. ii. iii. ArcGIS method based on finite differences,

D8 model in direction of steepest single flow direction, D model in direction of steepest outward slope on grid centered triangular facets. Readings - Theory ArcMap help: What is raster data? http ://desktop.arcgis.com/en/arcmap/latest/manage-data/ras ter-and-images/what-is-raster-data.htm ArcMap help: Fundamentals of raster data from Cell size of raster data to Raster dataset attribute tables http ://desktop.arcgis.com/en/arcmap/latest/manage-data/ras ter-and-images/cell-size-of-raster-data.htm Readings ArcGIS Pro Tools ArcGIS Pro An overview of the Spatial Analyst Toolbox https://pro.arcgis.com/en/pro-app/tool-reference/spa tial-analyst/an-overview-of-the-spatial-analyst-toolbo x.htm .

Read this to get a general sense of the tools available. Tools we will use now or later include, from the Surface toolset: Slope, Aspect, Contour; from the Zonal toolset: Zonal Statistics; from Map Algebra: Raster Calculator; from Interpolation: Spline and Kriging; and many tools in the Hydrology toolset. Readings Slope and Aspect How Slope Works https:// pro.arcgis.com/en/pro-app/tool-reference/spa tial-analyst/how-slope-works.htm How Aspect Works https:// pro.arcgis.com/en/pro-app/tool-reference/spa tial-analyst/how-aspect-works.htm Slope Handout http://hydrology.usu.edu/dtarb/giswr/2017/Slope.pdf Determine the length, slope and azimuth of the line AB.

Two fundamental ways of representing geography are discrete objects and fields. The discrete object view represents the real world as objects with well defined boundaries in empty space. Features (Shapefiles) (x1,y1) Points Lines Polygons The field view represents the real world as a finite number of variables, each one defined at each possible position.

f ( y) f ( x , y )dx x Continuous surface Rasters Numerical representation of a spatial surface (field) Grid or Raster TIN

Contour and flowline Raster and Vector Data Raster data are described by a cell grid, one value per cell Vector Raster Point Line Zone of cells Polygon Line as a Sequence of Cells Polygon as Zone of Grid Cells

From: http://resources.arcgis.com/en/help/main/10.2/index.html#/How_features_are_represented_in_a_rast er/009t00000006000000 / Raster and Vector are two methods of representing geographic data in GIS Both represent different ways to encode and generalize geographic phenomena Both can be used to code both fields and discrete objects In practice a strong association between raster and fields and vector and discrete objects A grid defines geographic space as a mesh of identically-sized square cells. Each cell holds a numeric value that measures a geographic attribute (like elevation) for that unit of space. The grid data structure Grid size is defined by

extent, spacing and no data value information Number of Columns Number of rows, number of column Cell sizes (X and Y) Top, left , bottom and right coordinates Grid values Real (floating decimal point) Integer (may have associated attribute table) Number of rows

(X,Y) NODATA cell Cell size NODATA Cells Cell Networks Floating Point Grids Continuous data surfaces using floating point or decimal numbers Integer valued grids to represent zones Value attribute table for categorical (integer) grid data Attributes of grid zones

Raster Sampling from Michael F. Goodchild. (1997) Rasters, NCGIA Core Curriculum in GIScience, http:// www.ncgia.ucsb.edu/giscc/units/u055/u055.html, posted October 23, 1997 Cell size of raster data From http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Cell_size_of_raster_data/009t00000004000000/ Raster Generalization Largest share rule Central point rule Map Algebra/Raster Calculation Example Cell by cell

evaluation of mathematical functions 5 6 7 6 3 2 3 4 =

2 5 3 2 Precipitation Losses (Evaporation, Infiltration) = Runoff Cell based discharge mapping by accumulation of generated runoff Radar Precipitation grid Soil and land use grid Runoff grid from raster calculator operations

implementing runoff generation formulas Accumulation of runoff within watersheds Raster calculation some subtleties + = Resampling or interpolation (and reprojection) of inputs to target extent, cell size, and projection within region defined by analysis mask

Analysis mask Analysis cell size Analysis extent Runoff Generation Raster Calculation Example Precipitation, P cm/hr Infiltration Rate, f cm/hr 4 3.1 100 m 6 100 m

150 m 150 m 2.2 3 4 1.8 2.5 3.5 1.5

2 2.7 4 Runoff R = P-f Lets Experiment with this in ArcGIS precip.asc ncols nrows xllcorner yllcorner cellsize NODATA_value 9999 4 6

3.1 4 infiltration.asc 2 2 0 0 150 - ncols 3 nrows 3 xllcorner 0 yllcorner 0 cellsize

100 NODATA_value -9999 2.2 3 4 1.8 2.5 3.5 1.5 2 2.7 Runoff calculation using Raster Calculator precip.asc - infiltration.asc The Result 1.8 1.6

2 1.3 Outputs are on 150 m grid. How were values obtained ? 100 m Nearest Neighbor Resampling with Cellsize Maximum of Inputs 2.2 4 - 2.2 = 1.8 1.8

1.5 150 m 4 3 2.5 3.5 2 2.7 6-4= 2 6

3.1 4 2 1.6 1.3 3.1 1.5 = 1.6 4 2.7= 1.3 4 1.8 Inferences

ArcGIS has used nearest neighbors to align cells ArcGIS has done raster computation at the scale of the coarsest input Is this what we want? How to control scale? What is meant by scale in this context? The scale triplet a) Extent b) Spacing c) Support From: Blschl, G., (1996), Scale and Scaling in Hydrology, Habilitationsschrift, Weiner Mitteilungen Wasser Abwasser Gewasser, Wien, 346 p. Scale and the interpretation of data From: Blschl, G., (1996), Scale and Scaling in Hydrology, Habilitationsschrift, Weiner Mitteilungen Wasser Abwasser Gewasser, Wien, 346 p.

Resample to get consistent cell size Spacing & Support Method 4 4 5 66 3.55 4.275 5

3.1 3.1 4 3.55 4 Calculation with consistent 100 m cell size grid precip100 - infiltration 1.8 2 2 1.75

1.775 1.5 1.6 1.55 1.3 Outputs are on 100 m grid as desired. How were values obtained ? 100 m

100 m cell size raster calculation 4 3.55 3.1 5 4.275 3.55 4 2.2 = 1.8 6 53 =2 5 64=2 3.55 1.8 = 1.75

4 4.275 2.5 = 1.775 100 m 5 3.5 = 1.5 1.8 2 2 1.75 1.775

1.5 1.6 1.55 1.3 3.1 1.5 = 1.6 2.2 3 4 3.55 2 = 1.55 4 2.7 = 1.3 1.8

2.5 3.5 1.5 2 2.7 Interpolation Estimate values between known values. A set of spatial analyst functions that predict values for a surface from a limited number of sample points creating a continuous raster. Nearest neighbor 1

Inverse distance weight z z i Bilinear interpolation Kriging (best linear unbiased estimator) Spline ri z (a bx )( c dy) z w i z i z c i x e i y e i Interpolation Comparison Grayson, R. and G. Blschl, ed. (2000) Further Reading Grayson, R. and G. Blschl, ed. (2000), Spatial Patterns in Catchment Hydrology:

Observations and Modelling, Cambridge University Press, Cambridge, 432 p. Chapter 2. Spatial Observations and Interpolation Full text online at: http:// www.hydro.tuwien.ac.at/forschung/publikationen/engl-publikationen/spatial-patterns-i n-catchment-hydrology.html Analysis of topographic surfaces represented by a Digital Elevation Model (DEM) 3-D detail of the Tongue river at the WY/Mont border from LIDAR. Roberto Gutierrez University of Texas at Austin Topographic Slope Defined or represented by one of the following Surface derivative z. Given z(x,y) evaluate (dz/dx, dz/dy)

Vector with x and y components (Sx, Sy) Vector with magnitude (slope) and direction (aspect) (S, ) See http://hydrology.usu.edu/dtarb/giswr/2018/Slope.pdf Slope and Aspect = aspect clockwise from North https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/how-slope-works.htm ArcGIS Slope tool y

a b c d e f g h i x

Similarly 2 a y b d 2 c e g

f h Slope magnitude = 2 i 2 x ArcGIS Aspect the steepest downslope direction dz = dy

dz / dx x atan atan dz / dy y dz = dx Use atan2 to resolve ambiguity in atan direction +180

atan2 y, x https://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/how-aspect-works.htm Example 30 a 80 d b 74

e 69 g 67 h 60 c 63 f 145.2o 56 i

52 48 Slope 0.229 2 0.329 2 0.401 dz (a 2d g) - (c 2f i) dx 8 * x_mesh_spacing (80 2 * 69 60) (63 2 * 56 48) 8 * 30 0.229 dz (g 2h i) - (a 2b c) dy

8 * y_mesh_spacing (60 2 * 52 48) (80 2 * 74 63) 8 * 30 0.329 atan (0.401) 21.8o 0.229 o Aspect atan 34.8 0.329 180o 145.2o Hydrologic Slope (Flow Direction Tool) - Direction of Steepest Descent 30

30 80 74 63 80 74 63 69 67

56 69 67 56 60 52 48 60 52 48

67 48 0.45 Slope: 30 2 67 52 0.50 30 Eight Direction Pour Point Model 32 64 16 8 128 1

4 2 ESRI Direction encoding Limitation due to 8 grid directions. ? The D Algorithm Proportion flowing to neighboring grid cell 4 is 1/(1+2) 4

2 1 Steepest direction downslope Proportion flowing to neighboring grid cell 3 is 2/(1+2) 3 2 Flow direction. 5 1 6

8 7 Tarboton, D. G., (1997), "A New Method for the Determination of Flow Directions and Contributing Areas in Grid Digital Elevation Models," Water Resources Research, 33(2): 309-319.) (http://www.engineering.usu.edu/cee/ faculty/dtarb/dinf.pdf) The D Algorithm Steepest direction downslope 3 4 z0

Elevations at each vertex zi z2 2 z1 2 5 1 0 1 z1 z 2

1 atan z 0 z1 2 6 7 8 z1 z 2 z 0 z1 S 2

If 1 does not fit within the triangle the angle is chosen along the steepest edge or diagonal resulting in a slope and direction equivalent to D8 D Example 30 80 74 eo 69 67 e7 60

52 284.9o 63 56 e8 z 7 z8 1 atan z0 z7 52 48 o atan 14 . 9

67 52 48 2 14.9o From ArcGIS Pro Help: 52 48 67 52 S 30 30 0.517 2

Summary Concepts Grid (raster) data structures represent surfaces as an array of grid cells Raster calculation involves algebraic like operations on grids Interpolation and Generalization is an inherent part of the raster data representation Summary Concepts (2) The elevation surface represented by a grid digital elevation model is used to derive slope important for surface flow The eight direction pour point model approximates the surface flow using eight discrete grid directions. The D vector surface flow model approximates the surface flow as a flow vector from each grid cell apportioned between down slope grid cells.