Labels

Wednesday, June 15, 2022

GIS 5103 Working with Geometries

 

This week our focus was on working with geometries. We learned how to read and write geometry objects (vector data) using our ever developing, Python skills. We were introduced to geometry tokens and used SHAPE@ and  OID@ in our lab assignment.  These tokens were used through  search cursor. We also delved deeper into the use for “for loops” by utilizing nested for loops.  In addition, we went over multipart feature and polygons with hole as they require a different approach. In the latter portion of this week’s lesson, we learned how to create/open a text file and enable the write method.

For our lab assignment we were tasked to write a Python script that creates a TXT file, writes the coordinates and object IDs for vertices in our rivers shapefile.

I created a workflow to help me organize my script which is pictured below:





The lab itself was quite challenging. The portion of the scrip containing the nested for loop and, write and print code required several re-writes. Getting the correct indents was the reason for this. Once that was finally corrected I was able to achieve the desire results in my TXT file. As you can see the OID, VertexID, X and Y coordinates are all present.


I have found that all to often you can overthink the process and get bogged down quickly. Stepping back and referring to the workflow diagram is helpful.




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

From Fragmented Data to Actionable Intelligence: A GIS Case Study

  Case Study: Building a Centralized GIS Platform for the Cleveland Museum of Natural History Natural Areas Client: Cleveland Museum of Na...