Moldule 5: Geometries

In this module I learned how to work with spatial data in ArcPro. Especially reading and writing vector data stored in a shapefile. The script I wrote in the assignment created a text file and writes coordinates, name, and OIDs for vertices in rivers.shp. This assignment took me less time to complete than last week’s. I had wished the correct page numbers and sections were provided in the instructions as it would have made the assignment easier. I had the most trouble with the .getPart(). I eventually figured out it was because I had SHAP@X and SHAPE@Y in my search cursor.

Below is a screenshot for part of the text file I created. It has the OID, vertex ID, x and y coordinates, and river name on each line. In total there was 25 features and 247 vertices. 

In our process summary I was asked to write pseudocode for my script and create a flowchart:

Start

Allow files to be overwritten

fc= “rivers.shp”

f= rivers_mea26.txt and allow writing

Print “Text file created”

cursor= arcpy.da.SearchCursor(fc,["OID@", "SHAPE@", "NAME"])

x= 0

For each row in cursor

                For each point in row get part

                x +=1

                o= string of the OID

                name= string of the NAME

Write to f “o, x, point.x, point.y, name”

Print f “o, x, point.x, point.y, name”

Close f

Delete row

Delete cursor

End






Comments