Lab 6: Geometries

 This week we learned about the properties of geometry objects i.e. polygons, polylines, points, and how to read their properties from existing features. Points, polylines, and polygons can be broken down into vertices and you can create new geometries from a list of coordinates of their vertices. 

Below are the results of the script written for this week's lab assignment. The first task of the lab assignment was to create a search cursor of a rivers shapefile. The cursor retrieved three pieces of information: the Object ID, Shape geometry object, which holds the spatial information about the polyline, and Name field. Then I created a txt file to store the script output. To write the data to the txt file, I wrote nested loops. The first for loop went through each individual row within the shapefile's attribute table. The second for loop iterated through each individual point/vertices within the polyline. I used the getPart() function to get the ordered sequence of points without need to create another loop. Inside the second for loop, I used the write() function to get an output for the row ID, Vertex ID, X coordinate, Y coordinate, and the name of the river. Once the loops were run, I closed the txt file to prevent "locks" and deleted the row and cursor variables. 





Comments