Screenshot of a portion of the printed text file. |
The script was short, but the syntax was a bit tricky to get the necessary variables to print correctly. In the end it was a matter of how many parenthesis were being used and recalling which variable was associated with each row called. A quick run down of the pseudocode used is as follows:
Start
Import arcpy
Set workspace environments
Define workspace
file path
Enable
overwriteOutput
Define
"fc" as "rivers.shp"
Define "rivers.shp"
variables to extract using SearchCursor
Cursor in
SearchCursor will look for data in the OID, SHAPE, and NAME fields
Create text file
Populate text
file with rivers.shp data
Define
a vertex id variable
For
Search Cursor results, define the row:
For
the Search Cursor row results.getPart():
print
the OID, vertexid, (x, y coordinates), and NAME fields
write
the OID, vertexid, (x, y coordinates), and NAME fields to the text file
Close the text file
Close the Search Cursor row
Close the Search Cursor
END
No comments:
Post a Comment