Working with Geometries in Python
For this week's assignment, we were tasked with exporting select attributes of a feature class from the shapefile to a TXT file. We needed the X and Y coordinates of the feature's vertices as well as the corresponding object (point) ID, vertex ID, and name. A flowchart and pseudocode were first produced to aid in problem-solving. I generalized the tasks in the flowchart so I could focus more on the final code's structure. Then, I added more details (such as variable names) in the pseudocode.
My biggest obstacles included using the wrong cursor type for the desired task (which I blame on late-night coding), small syntactical errors such as open parenthesis, and not realizing that the write.method inputs referred to the cursor parameters and not to the attributes in the shapefile.
As you can see from the output, there is an enormous amount of data being extracted from the feature. Python (and coding languages) provide methods for handling the vast amount of information that GIS analysts need to contend with.
Comments
Post a Comment