Thursday, July 28, 2016

Exercise 9: Create a Script Tool

Goals and Objectives

The purpose of this exercise was to create a custom script tool that will generate a swiss hillshade.  

Methods

In this exercise, a custom script tool was created by using Python and ArcMap.  For the scripting portion of this exercise, comments were used to annotate each section of code. The following steps were taken: 


  • importing system modules
  • importing Python modules: os, time, datetime, shutil, ArcGIS extensions
  • setting up local variables
  • setting up try except loop
  • adding workflow to loop: divide DEM, calculate a hillshade, run focal statistics, add DEM
  • setting up except statement to print an error message
  • creating custom toolbox in ArcMap
  • using the Add Script Wizard to add a custom script tool
  • debugging and running script
  • testing tool
  • creating map in ArcMap

Results

The final script and map displaying the results are displayed below.  

Figure 1: Map displaying swiss hillshades






No comments:

Post a Comment