Module 6: Geometries

 In this module, I worked with geometry objects and nested loops in Arcpy to extract vertex information from a shapefile. The objective was to access the geometry of river features, iterate through every vertex, and write the coordinate information to a txt file. 

I began the script by creating a Search Cursor for the rivers shapefile and accessing the OID, geometry and river name fields. Because the geometry object contains arrays of vertices, I used loops and the getPart() method to access each point that makes up a river feature. As the script iterated through the vertices, it assigned a vertex ID, printed the information and wrote the feature OID, vertex ID, X coordinate, Y coordinate, and river name to the created txt file.

The results of the script: 

This assignment helped me better understand how geometry objects are structured in GIS datasets. I learned how loops are used to move from features, to arrays, to individual vertices and how the getPart() method simplifies the process of accessing geometry data. I also gained experience writing structured output to a text file using search cursors.

Flowchart of the process:

Comments

Popular posts from this blog

Module 3: Error Handling and Debugging

Module 1: Crime Analysis

Module 2: LiDAR