NGA Advanced Python Programming for GIS, GLGI 3001-1

Overview and Checklist

PrintPrint

The lesson contains a lot of material, but it reads quickly. If there is a portion that is not clear or if you have questions, please feel free to use the canvas discussion boards and post your questions to the class. If you can answer a question, please feel free to answer it.  

Pace yourself and leave plenty of time for working on the assignment. If you have completed the assignment and want to try your hand at implementing a different means of multi-processing or try it on another process that may benefit your work, I encourage you try it and submit the code. There are many solutions and implementations so feel free to explore them and find one that works for your process. 

Learning Outcomes

  • Utilize the debugger and interpret its output.
  • Identify and properly use Python types and functions.
  • Execute a task using multiprocessing.

Lesson Roadmap

Steps for Completing Lesson 1
Step Activity Access/Directions
1 Engage with Lesson 1 Content Begin with Debugging.
2 Programming Assignment and Reflection  Submit your code for the programming assignment and 400 words write-up with reflections  
3 Quiz 1 Complete the Lesson 1 Quiz  
4 Questions/Comments Remember to visit Canvas to post/answer any questions or comments pertaining to Lesson 3
 

Downloads

The following is a list of datasets that you will be prompted to download through the course of the lesson. They are divided into two sections: Datasets that you will need for the assignments and Datasets used for the content and examples in the lesson.

Required:

Suggested:

  • USA.gdb.zip
  • In the Multiprocessing with raster data section you will also use some DEM raster data that you can download here if you want to follow along with the content. You can also wait with obtaining that data until you reach that section in the lesson material.

Assignments

We are going to use the arcpy vector data processing code from Multiprocessing with vector data (download Lesson1_Assignment_initial_code.zip) as the basis for our Lesson 1 programming project. The code is already in multiprocessing mode, so you will not have to write multiprocessing code on your own from scratch but you still will need a good understanding of how the script works. If you are unclear about anything the script does, please ask on the course forums. This part of the assignment will be for getting back into the rhythm of writing arcpy based Python code and practice creating a multiprocessing script. Your task is to extend our vector data clipping script by doing the following:

Expand the code so that it can handle multiple input feature classes to be clipped (still using a single polygon clipping feature class). The input variable data_to_be_clipped should now take a list of feature class names rather than a single name. The worker function should, as before, perform the operation of clipping a single input file (not all of them!) to one of the features from the clipper feature class. The main change you will have to make will be in the main code where the jobs are created. The names of the output files produced should have the format

clip_<oid>_<name of the input feature class>.shp

For instance clip_0_Roads.shp for clipping the Roads feature class from USA.gdb to the state featureclass with oid 0. You can change the OID to the state name if you want to expand the code.

Submit a single .zip file to the corresponding drop box on Canvas; the zip file should contain:

  • Your modified code files. Please organize the files cleanly.
  • A 400-word write-up of what you have learned during this exercise.

Questions?

If you have any questions, please send a message through Canvas. We will check daily to respond. If your question is one that is relevant to the entire class, we may respond to the entire class rather than individually.