Scripts routinely need to perform different operations based on some deciding criteria. The decision may be very simple, (‘if the field doesn’t exist, add the field’) or it may be more complex (‘if the shapefile has point geometry, compute a buffer, but if it has polygon geometry, perform an intersection’). Chapter 8 introduced ‘decision-making’ structures. These are often referred to as ‘branching’ structures, because the workflow diagram branches where the decision occurs. For example, the ‘Yellowstone Hiker’s Flowchart’ branches in three places: ‘Do I see an animal?’, ‘Is it a bear?’ and ‘Is it a killer rabbit?’. Pseudocode uses IF, THEN, ELSE IF, ELSE, and ENDIF key words to express decision-making workflows. This chapter presents the Python syntax, conditional expressions, ArcGIS tools that make selections, the arcpy Describe method, handling optional input, and creating directories.
Keywords
- Logical Operator
- Quotation Mark
- Boolean Expression
- Conditional Expression
- Empty String
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.