Question: We basically need to describe use python comments # on what going on in explaining using the chart below Describe, in your own words, how
We basically need to describe use python comments # on what going on in explaining using the chart below
Describe, in your own words, how you would write a script that prints out values of two fields LOCID and COUNTY using the SearchCursor from the airports.shp feature class. Let me know if you can handle it!! import arcpy #Substitute the next line with your own workspace. arcpy.env.workspace = "C:\Users\cassi\Desktop\Lab5" fc = "airports.shp" cursor = arcpy.da. SearchCursor (fc, ["NAME", "FEATURE"]} for row in cursor: print (row[0], row [1]) fc = airports.shp SearchCursor establishes read-only access to the records returned from a feature class or table. It returns an iterator of tuples. It has two required arguments: an input table fc and a list of field names ["NAME"). The script above creates a search cursor on the feature class and uses a for loop to iterate over all the rows of the attribute table to print row[O], the value of each record for the field NAME, and row[1], the value of each record for the field "FEATURE". Open the attribute table of the airports layer in the table of contents. Review the fields of the airports. Notice that there are fields called LOCID, FEATURE (type of airport), NAME, TOT_ENP (# passengers), and COUNTY, and the table contains 221 records. FID Shape * AREA PERIMETER AIRPRTX020 LOCID FEATURE 0 Point 0 0 5 477 Seaplane Base 1 Point 0 0 6 KCL Airport 2 Point 0 0 7 KKA Airport 3 Point 0 0 0 8 KVL Airport 4 Point 0 0 10 SKE Seaplane Base 5 Point 0 0 666 MM Seaplane Base 6 Point 0 0 667 KWF Seaplane Base 7 Point 0 0 668 KTN Airport 8 Point 0 0 669 KXA Seaplane Base 9 Point 0 0 670 HYL Seaplane Base NAME Hyder Chignik Lagoon Koyuk Kivalina Ketchikan Harbor Metlakatla Waterfall Ketchikan TOT_ENP STATE COUNTY FIPS 319 Prince of Wales-Outer... 02201 2697 AK Lake and Peninsula Bo... 02164 2346 AK Nome Census Area 02180 3313 AK Northwest Arctic Boro... 02188 46644 AK Ketchikan Gateway Bo... 02130 15387 AK Prince of Wales-Outer... 02201 2018 AK Prince of Wales-Outer... 02201 132451 AK Ketchikan Gateway Bo... 02130 455 Prince of Wales-Outer... 02201 4170 AK Prince of Wales-Outer... 02201 STATE_FIP: 02 02 02 02 02 02 02 02 Kasaan 02 Hollis 02
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
