GIS Programming Module 5: Working with Geometries


Text Results: Row ID, Vertex ID, X, Y Coordinate (see below for more details):


Script Flowchart:


In this week’s module, we learned how to write Python script in Spyder that would iterate an array of vertices from a feature class that contained polylines (representing rivers on a map) and return a list of the X, Y coordinates for each vertex in the river polyline. We also wrote script that would take this data and write it into a new text file (see text file image above). Working through the exercise was helpful, but the lab assignment really helped me to understand how each block of code worked. 

To achieve the task outlined above for the module assignment, we needed to break the array of objects down with three levels of nested ‘for loops’. We used the loops to iterate through the three levels of data: feature, array, and points. We used the write() method to print this data into a text file. In the end, the text file included the feature/row OID, the vertex ID, the X coordinate, and Y coordinate for each vertex in the polyline. 

It has been interesting to learn more and more about programming and how we can use script to change feature class attribute tables and create new text files. I am starting to see more each week about how Python programming can really help you analyze and organize large amounts of data from an attribute table. I am learning a lot by working through my script errors. I am improving at finding typos and syntax errors in my script before running it. Researching solutions teaches me more and more about the scripts we’re using each week. I look forward to learning more Python scripts that will help me improve my skills in GIS.

Comments