GIS 5103 - Module 5

Overview:
In this module, a new file geodatabase is created in Python, files from one folder are copied into the gdb, a selection from one file is made using an SQL query format, and the output is used to inform a dictionary. The dictionary ultimately displays all New Mexico cities which are county seats, and their populations.


Process: 
To begin this module, I had already completed the exercises, which was very helpful. It provided a very clear direction for where to go with the different sections in this module.
1) Input arcpy and set the input and output data paths, and ensure they are able to be overwritten. This includes creating an output to a new file gdb.
2) Define a list of feature classes in the environment, and copy them to the new gdb.
3) Create a search cursor to search within the FEATURE column and select out all rows which contain the value of County Seat.
4) Create a dictionary that defines the key as the city name, and the value as the population, for those cities indicated by the search cursor to be county seats.
5) Print the populated dictionary.

Issues:
1) I had issues getting the program to run past the CopyFeatures_management tool. I was getting different errors with different attempts, but namely the output was giving me the error that the GDB either did not exist. After a couple minor syntax changes, I got the program to run and to print the completion statement, yet when I opened the GDB, it was empty. To get around this, I actually went back to the exercise template where my feature classes successfully copied that template, but replaces the output destination stated there to be my new GDB, and it worked. I am honestly not sure what the actual change was, as it looked indiscernible except for the new GDB name replacing the GDB name from the exercise. Considering this, there must have been some very hard to detect syntax error I expect.

2) I had Error 999999 with the cursor. I followed the recommendation provided by Dr. Morgan in the discussions, editing my print statement.

3) In the dictionary part, my dictionary was coming up empty. Ultimately it was resolved when I added the cursor statement again above the for loop. I was getting no error statements, only a length of zero in my dictionary. It would seem that somewhere between the cursor statement and the dictionary, the cursor results are lost so I simply added the cursor line once more to recall that information.

4) When I reached the dictionary part, I had to close out and restart Sypder each time I needed to run the code. It would tell me that the destination was already created, despite the overwriteOutput tool. Because this issue was stated as a possibility in the instructions, because the issue only arose after reaching this step, and because each time I re-opened the program the code would run, I am assuming that it is the error stated in the module instructions and not an error in the code. To get around this, I commented out the lines where the copy features occurred, so they would not have to run.

Please see output results below:
Note: bottom output of dictionary results was very small, so image was copied & cut in half to improve visibility.








Comments

Popular posts from this blog

GIS6005 - Module 1 San Francisco Bay Area, Point of Interest

GIS 5100 Module 2

GIS 5100 Module 6