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.
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
Post a Comment