GIS4102 Lab 6

This was a challenging lab for me. I started this course as a total newbie to Python, and feel like I've gotten to a point where I have pulled off some challenging tasks in this 6 week course. Here we had to take a shapefile of rivers in Hawaii, and use a search cursor with for loops to extract 6 features: object ID, X and Y coordinate data, Name, geometry object, and a vertex ID that we generated, and print them to a text file and our console. Here is the flowchart for this process:
The first steps are to import the relevant modules, set the environment,and turn on overwriting. There are apparently two ways to handle setting up the text file, either creating it beforehand with write mode turned on, or allowing the program to create it. I created it beforehand. I encountered a problem initially because I didn't have the name exactly matching in my code, which I think may have been a non-issue if I'd allowed Python to create it. Then we created a search cursor to extract the relevant info from the attributes of the rivers.shp file, and nested for loops to extract each relevant feature from the rivers.shp attributes, write them to a txt file in rows, and print to our console. The final .txt output is here:

Comments

Popular posts from this blog

GIS 4006 Computer Cartography Intro Post

GIS4035 Lab 2, Land Use/Land Cover

GIS 4035, Lab 4: Spatial Enhancement and Multispectral Analysis