The second part of Project 1 will help you get some practice with Python. At the end of Lesson 1, you saw three simple scripting examples; now your task is to write your own script. This script will create vector contour lines from a raster elevation dataset. Don't forget that the ArcGIS Desktop Help can indeed be helpful if you need to figure out the syntax for a particular command.
Earlier in the lesson you were introduced to the Fox Lake DEM in your Lesson 1 data folder. It represents elevation in the Fox Lake Quadrangle, Utah. Write a script that uses the Contour tool in the Spatial Analyst toolbox to create contour lines for the quadrangle. The contour interval should be 25 meters and the base contour should be 0. Remember that the native units of the DEM are meters, so no unit conversions are required.
Running the script should immediately create a shapefile of contour lines on disk.
Follow these guidelines when writing the script:
- The purpose of this exercise is just to get you some practice writing Python code. Therefore, you are not required to use arcpy.GetParameterAsText() to get the input parameters. Go ahead and hard-code the values (such as the path name to the dataset).
- Consequently, you are not required to create a script tool for this exercise. This will be required in Project 2.
- Your code should run correctly from PythonWin. For full credit, it should also contain comments, attempt to handle errors, and use legal and intuitive variable names.
The deliverables for Project 1, Part II are:
- The .py file containing your script.
- A short writeup (about 300 words) describing how you approached the problem, any setbacks you faced, and how you dealt with those. These writeups will be required on all projects.
Finishing Lesson 1
To complete Lesson 1, please zip all your Project 1 deliverables (for parts I and II) into one file and submit them to the Project 1 Drop Box in Canvas. Then take the Lesson 1 Quiz if you haven't taken it already.