1 / 26

Map Algebra

Map Algebra. Lesson 5A overview. Introduction to Map Algebra (5A) Language components Syntax and rules Objects Operators Commands Exercise 5A Map Algebra functions (5B) Function syntax Local functions Focal and Block functions Zonal functions Global functions Exercise 5B.

danil
Download Presentation

Map Algebra

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Map Algebra

  2. Lesson 5A overview • Introduction to Map Algebra (5A) • Language components • Syntax and rules • Objects • Operators • Commands • Exercise 5A • Map Algebra functions (5B) • Function syntax • Local functions • Focal and Block functions • Zonal functions • Global functions • Exercise 5B

  3. Map Algebra: The language of raster • A data-manipulation language designed for raster • Math-like expressions AqSuit = (SoilSuit * 0.75) ÷ (SlpSuit * 0.25) • Parts of the language: • Objects - Raster, vector, numbers, constants, variables... • Operators – “+”, “-” ,“/” ,“GT” ,“LE”, “AND”, “OR” • Functions - SLOPE, FOCALMEAN, SIN, • Central part of the language; over a hundred • User interface implements some, like SLOPE • Rules - For building expressions and using functions

  4. Map Algebra geoprocessing tools Single Output Map Algebra Output path: Appears on the tool Multi Output Map Algebra Output path: Set in Environment Settings dialog

  5. Geoprocessing tools vs Model Builder

  6. Expression syntax rules • Delimit operators and objects with blanks Wrong: Layer+Layer2+Layer3 Right: Layer1 + Layer2 + Layer3 • Operators are evaluated by precedence level Layer1 + Layer2 * Layer3 • Override operator precedence with parentheses (Layer1 + Layer2) * Layer3 • Nested parenthetical expressions evaluate first (Layer1 + Layer2)/ 4 - Layer3

  7. Expression results • Expressions return grids, vector data, tables, etc. • Depends on functions used • Most expressions return grids • Tools supply default output names • Can rename • Layers added to ArcMap Table of Contents

  8. 3 6 9 Expression evaluation • How expressions are processed • 1. Define an empty output raster based on the analysis environment • 2. Position to the next output cell (start at row 0, column 0) • 3. Resample input raster(s) to determine corresponding cell values • 4. Evaluate the expression and write the result to the output cell • 5. Repeat steps 2—4 for all output cells = + Layer1 Layer2 Outgrid

  9. Map Algebra objects • Objects used in expressions or as function arguments • Raster as layers or paths SLOPE (Elevation) SLOPE (a:\student\database\arelev) • Vector as paths SHAPEGRID (a:\student\database\avroad.slip) • Tables - Output by a few functions • Numbers - Integer or decimal • Scientific notation okay (1.234e2 is the same as 123.4) • Constants and variables (P1, DEG, $$ROWMAP, $$NROWS, etc.) • Built in for your convenience

  10. User attributes in expressions • You may use numeric VAT fields in expressions • Reference with Layer.field notation • Layer alone is assumed to be Layer.Value • You may join tables to raster VAT file • Use joined fields for symbology, selection • Cannot use in Map Algebra expressions Vegetation.vat Soil.vat Vegetation.suit + soil.suit

  11. 4 T 3 1 1 3 1 1 2 4 T 3 4 1 3 T 1 1 1 T 4 1 3 1 3 1 1 4 T 3 0 ND F ND 0 ND 1 4 3 T 1 2 T 4 1 ND 1 ND ND ND ND 0 F 0 1 2 T 2 1 3 2 1 T 1 1 3 3 3 T 1 2 1 1 1 6 1 T 2 1 1 2 1 4 T 1 1 1 T 1 2 1 1 ND T 3 ND 2 1 T 2 1 1 ND 0 F ND 0 ND 0 0 ND F ND ND 1 T 2 2 1 1 4 1 2 1 1 T 4 1 T 1 1 2 2 5 1 T 3 1 1 T 1 2 1 1 0 0 ND ND F ND Special cell values in Map Algebra • Logical - Non-zero values are True, zero is False • NoData - If any input is NoData, the output is NoData As values As True/False As Logical = + Layer1 Layer2 Layer3

  12. Map Algebra operators • Work with two inputs, like Slope GE 10

  13. 3 3 3 3 1 0 3 1 0 3 3 3 3 1 0 3 3 3 0 3 3 1 3 3 1 3 3 3 0 3 3 3 3 0 1 3 1 0 3 3 3 3 3 4 1 3 3 4 1 3 0 3 3 3 4 1 4 4 0 4 3 3 1 3 3 0 3 3 3 1 4 4 4 3 1 3 3 4 4 4 4 1 4 4 4 0 1 4 4 4 3 3 3 0 3 1 3 1 3 3 0 3 0 4 4 4 5 4 4 4 0 4 5 0 4 0 4 5 0 4 1 4 4 4 0 4 4 4 4 0 1 4 4 5 4 0 0 4 0 5 4 4 0 4 0 4 0 5 4 4 Examples of operators • Using EQ to find changes in lad use • Using over to update land use EQ LU90 LU95 LUDIFF OVER NewMall LU90 LU_update

  14. ArcGIS Spatial Analyst command • There are a few commands • Tasks not suited to functions • Enter in Raster Calculator • Not part of Map Algebra • Cannot use in expressions • Mostly data management • Build attribute tables • Create, manage grid stacks • Others

  15. Exercise 5A overview • Work with Map Algebra • Operators • Objects • Commands

  16. Lesson 5B overview • Introduction to Map Algebra (5A) • Language components • Syntax and rules • Objects • Operators • Commands • Exercise 4A • Map Algebra functions (5B) • Function syntax • Local functions • Focal and Block functions • Zonal functions • Global functions • Exercise 5B

  17. Map Algebra functions • Do most of the work in Map Algebra • About 168 functions • Can classify functions by processing method Focal Local By Cell By neighborhood Zonal Global By zone By raster

  18. Function syntax rules • Functions return values • Use as “objects” in expressions Farmsoils + CON(S1ope LE 15, 1, 0) • Arguments in parentheses and comma-delimited SLOPE(Elevation, DEGRE) • Arguments may be other functions or expressions* SLOPE (IDW(c:\data\elevpoints, spot), DEGREE) • * If they return the data expected by the argument • * If the function allows it

  19. Local functions • Compute values based on the current output cell • Most functions are local • Each cell is processed, starting at top left

  20. Focal functions • Compute values by cell neighborhoods • Writes result to current cell in the output grid • Neighborhood is a moving window over input • General syntax: FOCALxxx(InLayer, neighborhood, (DATA | NODATA))

  21. 5 3 1 1 0 1 0 1 0 0 1 1 0 1 1 1 0 Focal neighborhoods • You may define the neighborhood geometry • Create a custom neighborhood with a kernel file Default Rectangle Circle Annulus Wedge Kernel.txt FOCALSUM (Elev) FOCALSUM (Elev, Rectangle, 5, 3) FOCALSUM (Elev, Circle, 2) FOCALSUM (Elev, Annulus, 2, 3) FOCALSUM (Elev, wedge, 4, 300, 330)

  22. Zonal functions • Most summarize values in a layer by zones in another • Require two input rasters: Zone and Value PopByDistrict District Population Zone layer Value layer Output layer ZonalSum(District, Population)

  23. 23 1 1 23 13 2 2 13 13 2 23 1 1 23 1 23 2 13 2 13 3 45 45 3 23 1 2 13 2 13 3 45 45 3 1 23 23 1 2 13 45 3 45 3 1 23 1 23 1 23 Global functions • May access all input cells to compute output cell value • Mostly do distance • REGIONGROUP assigns unique lD’s Regions with unique ID’s Vegetation Zones REGIONGROUP(Vegetatation)

  24. The CON function • IF-THEN-ELSE function for Map Algebra CON(<condition>, <true_expression>, {false_expression}) IF TEST THEN(TEST= 1) ELSE(TEST=O) • May be a simple IF-THEN-ELSE CON(Slope <20, 1, 0) • Or nest CONs for an ELSE-IF CON(Slope < 20, 1, CON(Slope < 40, 2, CON(Slope < 90, 3, 5) ) ) First CON {false expression} Second CON {false_expression}

  25. 3 1 0 3 3 1 0 3 6 0 1 6 6 6 0 1 1 0 6 6 1 0 3 3 0 3 1 3 3 1 3 0 6 0 6 1 0 6 6 2 1 ND 4 0 0 1 4 ND ND 1 3 3 0 6 6 2 6 6 0 2 4 0 1 ND 1 4 0 ND 0 3 2 3 0 3 3 2 0 6 2 6 1 0 4 ND 0 4 2 ND 0 3 3 2 0 2 3 3 0 3 2 3 Working with NoData • ISNULL tests for NoData: Returns true or false • SETNULL assiqns NoData to cells that pass a test Vegetation Output ISNULL(Vegetation) Landuse Output SETNULL(Landuse EQ 4, Landuse)

  26. Exercise 5B overview • Work with Map Algebra functions • Work with local functions • Work with focal functions • Work with zonal functions • Work with global functions

More Related