During this week's lab we focused on creating and editing information from attribute tables in ArcGIS using Python. I first created a new file geodatabase, and then copied data from the Data file into the new database. I then used the search cursor function to create a list of all cities that had the feature "County Seat", along with the population of all of these cities. 1 During the creating a search cursor step, I had trouble getting the search cursor to print the population, feature, and name function together. I initially was able to set up the delimintedField function to remove all cities that were not county seats, however the code I had written was just reporting the names of these cities. In order to remedy this situation, I created three fields (field, field2, and field3) and then defined these fields as NAME, POP_2000, and FEATURE, respectively. I then ran the delimintedField function as normal, and had the print function at the end print “for row in cursor” with each field listed individually as part of the result with a “row.getValue()” function. Field two had to be listed as a string, as it contained a string value. Additionally, I created a dictionary where the population of a city would populate when the name was input.
Comments
Post a Comment