In this module, the use of Python scripts inside specific Esri ArcMap tools will be demonstrated. In addition to the Python scripts, which will be developed, xml code will also be used and explained. The Label function will be expanded beyond simple labeling into functions that are more dynamic. In the Field Calculator, If statements will be used to change the value of an attribute.
This work will be performed without the use of an IDE or the Python Window used in Esri ArcMap. The scripts will be written directly with the tool. The code used could be written in an editor, copied and pasted into the tool, but for this example, the code will be composed directly. The length of the code can be similar to any other code generated and has no parameters that require it to be any certain length. If the code is relatively short it should be written directly in the tool, but for lengthier and more complicated code, the use of an editor should be considered.
This work will be performed without the use of an IDE or the Python Window used in Esri ArcMap. The scripts will be written directly with the tool. The code used could be written in an editor, copied and pasted into the tool, but for this example, the code will be composed directly. The length of the code can be similar to any other code generated and has no parameters that require it to be any certain length. If the code is relatively short it should be written directly in the tool, but for lengthier and more complicated code, the use of an editor should be considered.
Tools and concepts
- If/elif/else
- Return
- Def
- Xml Code