In this lab, we were tasked with writing a script that achieved the following:
1. Create a new geodatabase.
2. Copy all the data that was stored in our Data folder and place it into the newly created geodatabase.
3. Perform a search and populate a dictionary with the queried information.
The process began with of course creating the geodatabase. A variable was set that would be assigned for all the features in our workspace folder. Using a for loop, all the shapefiles were copied into the geodatabase and converted to feature classes. A search cursor was then created to view into the cities layer, which retrieved the name, feature, and population fields. The feature field only searched for cities that were listed as a county seat. Utilizing a second for loop, these previously queried values were then placed into a dictionary and the information was then printed.
This was no doubt a very challenging lab. To date, I do believe this is the longest script we have written thus far.
1. Create a new geodatabase.
2. Copy all the data that was stored in our Data folder and place it into the newly created geodatabase.
3. Perform a search and populate a dictionary with the queried information.
The process began with of course creating the geodatabase. A variable was set that would be assigned for all the features in our workspace folder. Using a for loop, all the shapefiles were copied into the geodatabase and converted to feature classes. A search cursor was then created to view into the cities layer, which retrieved the name, feature, and population fields. The feature field only searched for cities that were listed as a county seat. Utilizing a second for loop, these previously queried values were then placed into a dictionary and the information was then printed.
This was no doubt a very challenging lab. To date, I do believe this is the longest script we have written thus far.
Comments
Post a Comment