Presentation is loading. Please wait.

Presentation is loading. Please wait.

Map Algebra. Lesson 5A overview  Introduction to Map Algebra (5A)  Language components  Syntax and rules  Objects  Operators  Commands  Exercise.

Similar presentations


Presentation on theme: "Map Algebra. Lesson 5A overview  Introduction to Map Algebra (5A)  Language components  Syntax and rules  Objects  Operators  Commands  Exercise."— 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 hundredCentral part of the language; over a hundred User interface implements some, like SLOPEUser 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 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 369 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.234e 2 is the same as 123.4)  Constants and variables (P1, DEG, $$ROWMAP, $$NROWS, etc.) Built in for your convenienceBuilt 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 ValueCountDescSuit1012450Grass1 20165780Mixed3 30132187Pine2 4015433Oak5ValueCountDescSuit232450Sand2 4665780Loam1 8732187Clay6 995433Rock9 Vegetation.vat Soil.vat Vegetation.suit + soil.suit

11 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 32113 02402 13641 32002 44510 As values TTTTT FTTFT TTTTT TTFFT TTTTF As True/False 11111 01101 11111 11001 11110 As Logical 11111 ND11 1 11111 11 1 1111 Layer1 33333 ND3 2 22111 1 1 1121 Layer2 44444 ND4 3 33222 2 2 2232 Layer3 + =

12 Map Algebra operators  Work with two inputs, like Slope GE 10 Arithmetic + Addition + Addition - Subtraction * Multiplication * Multiplication /, DIV Division MOD Modulus - Unary minus - Unary minus Boolean ^, NOT Logical complement &, AND Logical And I, OR Logical Or !, XOR Logical Xor Relational = =, EQ Equal ^=, <>, NE Not Equal <, LT Less than <=, LE Less than or equal >, GT Greater than >=, GE Greater than or equal Combinatorial COR Combinatorial Or CAND Combinatorial And CXOR Combinatorial XOR CXOR Combinatorial XOR Logical DIFF Logical difference DIFF Logical difference IN {list} Contained in list OVER Replace

13 Examples of operators  Using EQ to find changes in lad use  Using over to update land use 33333 33334 33344 33444 44444 LU90 33333 33334 33344 33555 44555 LU95 11111 11111 11111 11000 11000 LUDIFF EQ 00000 00400 04440 00400 00000 NewMall 33333 33334 33344 33444 44444 LU90 33333 33434 34444 33444 44444 LU_update OVER

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 Local Focal ZonalGlobal By Cell By neighborhood By zoneBy 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 Focal neighborhoods  You may define the neighborhood geometry  Create a custom neighborhood with a kernel file FOCALSUM (Elev) FOCALSUM (Elev, Rectangle, 5, 3) FOCALSUM (Elev, Circle, 2) FOCALSUM (Elev, Annulus, 2, 3) FOCALSUM (Elev, wedge, 4, 300, 330) FOCALSUM (Elev) FOCALSUM (Elev, Rectangle, 5, 3) FOCALSUM (Elev, Circle, 2) FOCALSUM (Elev, Annulus, 2, 3) FOCALSUM (Elev, wedge, 4, 300, 330) DefaultRectangleCircleAnnulusWedge 53 11010 10011 01110 Kernel.txt

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

23 Global functions  May access all input cells to compute output cell value  Mostly do distance  REGIONGROUP assigns unique lD’s 11222 11122 33122 33112 33111 23 13 23 13 45 2313 45 23 13 45 23 Vegetation Zones Regions with unique ID’s REGIONGROUP(Vegetatation)

24 The CON function  IF-THEN-ELSE function for Map Algebra CON(,, {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) ) ) CON(Slope < 90, 3, 5) ) ) First CON {false expression} Second CON {false_expression}

25 Working with NoData  ISNULL tests for NoData: Returns true or false  SETNULL assiqns NoData to cells that pass a test 11111 11112 11ND22 11222 12222 Output 00000 00000 00100 00000 00000 Vegetation ISNULL(Vegetation) 33666 33366 44366 44336 44333 33666 33366 ND 366 336 333 SETNULL(Landuse EQ 4, Landuse) LanduseOutput

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


Download ppt "Map Algebra. Lesson 5A overview  Introduction to Map Algebra (5A)  Language components  Syntax and rules  Objects  Operators  Commands  Exercise."

Similar presentations


Ads by Google