GEOG 489
Advanced Python Programming for GIS

1.1 Overview and Checklist

PrintPrint

Lesson 1 is two weeks in length. The goal is to get back into Python programming with arcpy, in particular doing so under ArcGIS Pro, and learn about the concepts of parallel programming and multiprocessing and how they can be used in Python to speed up time-consumptive computations. In addition, we will discuss some important general topics related to programming such as debugging code complemented by a discussion of profiling code to detect bottlenecks, version control system software like GitHub, and different integrated development environments (IDEs) available for Python. The IDE we are going to start with in this class is called Spyder but one part of the first homework assignment will be to try out another IDE and present it in a short video.

Some sections in this lesson related to 64-bit processing for ArcGIS Desktop and code profiling are optional so that you can decide for yourself how deep you want to dive into the respective topic. The lessons in this course contain quite a lot of content, so feel absolutely free to skip these optional sections; you can always come back to check them out later or after the end of the class.

Please refer to the Calendar for specific time frames and due dates. To finish this lesson, you must complete the activities listed below. You may find it useful to print this page out first so that you can follow along with the directions.

Steps for Completing Lesson 1
Step Activity Access/Directions
1 Engage with Lesson 1 Content Begin with 1.2 Differences between Python 2 and Python 3
2 Video Presentation of IDE Research Choose the IDE you wish to research (in the IDE Investigation: Choose Topic discussion forum) and submit a video demonstration and discussion (to both the Assignment Dropbox and the Media Gallery). When picking your IDE, please take into account that we would like to see all the IDEs presented by at least one student.
3 Programming Assignment and Reflection Submit your modified code versions and ArcGIS Pro toolboxes along with a short report (400 words) including your profiling results and a reflection on what you learned and/or what you found challenging.
4 Quiz 1 Complete the Lesson 1 Quiz.
5 Questions/Comments Remember to visit the Lesson 1 Discussion Forum to post/answer any questions or comments pertaining to Lesson 1

List of Lesson 1 Downloads

All downloads and full instructions are available and included in the Lesson 1 course material. The list below is for those who want to frontload downloading items.

Data

  • USA.gdb.zip
  • In section 1.6, you will also use some DEM raster data that you can download with a script we provide there. You can wait with obtaining that data until you reach that section in the lesson materials.

Software

  • Spyder- Python IDE Spyder is the default IDE for Lesson 1 before we will review other IDEs at the end of the lesson and you are then free to use whichever IDE you prefer in the rest of the course. Installation instructions for Spyder can be found in Section 1.5.

Optional software: The following software will only be required if you decide to follow along the steps described in optional sections included in this lesson that contain complementary materials. We recommend that you do not install this software now, but wait until you are sure that you want to test them out.

  • Optional: 64-bit processing for ArcGIS Desktop- You'll find this link on the "Optional: 64-bit Geoprocessing downloads for ArcGIS" page under Lesson 1 in Canvas. Detailed instructions can be found in Section 1.6.2.
  • Optional: QCacheGRind- just unzip, don't run the .exe. See Section 1.7.2.2 for more information.

Optional Python modules

These modules are also only needed for optional materials in this lesson. So the same as said above holds here: We recommend that you do not install these now, but wait until you are sure that you want to test them out.

To install pyprof2call tree (Section 1.7.2.2)- open Python command prompt in Administrator mode and type in:

scripts\pip install pyprof2calltree

If received, ignore the message about upgrading pip.

To install line_profiler (Section 1.7.2.4)- open Python command prompt in Administrator mode and type in:

scripts\pip install line_profiler

If you receive an error that "Microsoft Visual C++ 14.0 is required", visit Microsoft's Visual Studio Downloads page and download the package for "Visual Studio Community 2017" which will download Visual Studio Installer. Run Visual Studio Installer, and under the "Workloads" tab, you will select two components to install. Under Windows, check the box in the upper right-hand corner of "Desktop Development with C++," and under Web & Cloud, check the box for "Python development". After checking the boxes, click "Install" in the lower right-hand corner. After installing those, open the Python command prompt again and enter:

scripts\pip install misaka

If that works, then install the line_profiler with...

scripts\pip install line_profiler

You should see a message saying “Successfully installed line-profiler-2.1.2" although your version number may be different and that’s okay.