Wednesday, July 8, 2015

Module 7 - Explore/Manipulate Spatial Data

Module 7 looked more intimidating than it actually was. We covered two chapters in our text and had a decently long exercise before starting the lab. Once I did all that though, I was pretty well set up to move quickly through creating my script.

The lab consisted of writing a stand-alone script in PythonWin that would create a new geodatabase in a specified drive and folder, then copy a series of feature classes from one folder to the new gdb, use a search cursor to populate a blank dictionary with the name and population of a cities feature class, print the dictionary, and print processing messages. Whew!

I didn't run into too may challenges, or at least the problems I did have in my code didn't take to long to solve. For creating the geodatabse it was a matter of making sure ArcMap and ArcCatalog were closed before running the script or else the overwrite statement would throw an error. I didn't have much trouble creating my search cursor line, however, I did have to spend some time thinking about how row indexing and field names worked when it came time to populate my dictionary in relation to the previous search cursor step. A brief hiccup at the end with my dictionary printing each time a new key/value set was added, but that was a simple solution of moving my print statement outside of the for loop. All in all, I think this module went pretty well considering the amount of information covered in it.


The two screenshots are the output of the Module 7 script where I created a geodatabase, did a cursor search, and populated and printed a dictionary. 

No comments:

Post a Comment