Wednesday, July 13, 2016

Writing Geometries

   In this lab we worked with a river shapefile, set up a search cursor with nested for loops in order to declare some of its geometries, and wrote those geometries to the text using the .write method. Below is a snip of what a portion of the text file result looks like.



Here is the flowchart of the code, with pseudocode below.


Pseudocode:
Start
Import modules
Import env
Set workspace
Set variable

Create text, enable writing
Set SearchCursor array 
For loop
Set vertex ID variable to 0
For loop/get.Part method
Element 0 of cursor array declared (feature #)
##Vertex ID printed
Element 1 of cursor array declared (x, y coords)
Element 2 of cursor array declared (name)
Vertex ID variable increased by 1
Write argument declared 
Print statement showing all five elements in single line format
Delete row and cursor
Close file

No comments:

Post a Comment