GIS 4048 - Module 5 Assignment: Working with Geometries
Working with Geometries
The screenshot is a final product of a written script that created a TXT file writing the coordinates and object IDs for specific rivers (vertices) in a shapefile. The screenshot was taken from NotePad++ and consists of a total of 247 vertices.
Screen shot of final TXT file:
Flowchart:
During this week’s lab I had the most
opportunity with the cursor and write( ) portion of the assignment. While
trying to construct my code I noticed I was running into the same few errors every
time I felt I made progress. Some of the errors I was getting in the IPython
window were:
“typeerror: 'point'
object is not iterable”
“typeerror: 'row' object
is not subscriptable”
After some guidance and explanation
from the wonderful T.A. I realized my mistake. To correct the two errors above
I had to correct my field values and my write statement. At the beginning on my
script, I added my “fields”. For example, [field=’OID@’, ‘SHAPE@’, and ‘NAME’].
Without having my fields set my script had nothing to refer to, creating an
error when trying to run.
Next, I did not realize
I was grouping my X and Y coordinates separately. It is important to make sure the
X and Y go together as one, because you cannot have one without the other. When
you plot a point or coordinate you do not have just one, right?
Lastly, there was an
error in my write( ) statement and print statement that was creating some headache.
I was forgetting that I needed to set a string to everything I was calling for
in my write and print statements. Specifically my error was when trying to write
and print ‘NAME’ or for example, str(row[2]). This is because ‘NAME’ has more than one word
per each entry, so I added a string for success. I feel my biggest “ah ha” moment
was when I realized that a string (str) is needed when a specified value has
more than one entry and realizing
my script only needed one print statement because it needs to run a one chunk.
As for references for completing this assignment, the most helpful
script reference was from our Module 5 exercise on page 4, and this was a major
contributor to our assignment script.


Comments
Post a Comment