Friday, August 3, 2012

Module 8 - Cursors....

My Ever-Growing GIS/Programming Library
This module was an excellent view of cursors.   Cursors are essential to the toolbox of any programmer that works with data of any sort.   I was surprised to see the similarities in concept to the T-SQL environment of Microsoft SQL Server.

Notes to Future Self:
  • When debugging, remember not only to look at the line(s) of code where you THINK the problem is, but also at other lines that may execute.  I ran into a problem where I was convinced that the UpdateCursor just wasn’t working and then I went back a few lines and saw that my “query” was limiting the results that the operation was running.

  • When debugging, it is helpful to comment out lines and re-add them in smaller quantities to focus in like a laser on the area you are concerned with.
  • Also when debugging, remember to try various ways of running the program… PythonWin, IDLE, and by double clicking the script.   Insight might be gained from each one of these attemps.
  • Don’t reinvent the wheel…   The ArcGIS Online Help is GREAT on each command, including code snippets that might help as well.   Also, be sure to be competent at using your search engine of choice to look up both arcpy as well as general python fixes to get around any issues you are experiencing.

No comments:

Post a Comment