Thursday, June 20, 2024

Module 6 - Working Geometries



Module 6 consisted of turning river data into a neat TXT file. The mission was simple—grab the coordinates and IDs for vertices in a shapefile. First, I set up my workspace, ready for action. With ArcPy as my trusty tool, I created a search cursor to fetch the OID, geometry (SHAPE@), and NAME fields. It felt like being a digital detective, diving into the shapefile to uncover hidden data gems.

With my search cursor ready, I opened the TXT file in write mode, eager to fill it with vertex data. Each feature got its own vertex ID counter, ensuring no vertex was left behind. As I looped through the features and their vertices, I felt like an explorer mapping out new territory. Extracting X and Y coordinates from each vertex was like finding coordinates on a treasure map. I wrote down the details OID, vertex ID, X coordinate, Y coordinate, and river name while also printing them to the console to keep tabs on my progress.

Finally, after capturing all the vertex data, I closed the TXT file and did a quick verification dance. The file looked great, filled with well-organized data ready for use. This exercise showed me that even technical tasks can be fun and rewarding. It was a great mix of learning and coding, proving that GIS programming can be productive and enjoyable.



Wednesday, June 12, 2024

Module 5 - Exploring & Manipulating Data

 This week's assignment focused on manipulating spatial data using ArcGIS Pro. The tasks involved creating a new file geodatabase, copying feature classes into this geodatabase, and using search cursors to extract data. One key challenge was handling the ExecuteError when creating the geodatabase, which was resolved by ensuring no other instances of ArcGIS Pro were accessing it and adding a check to delete the existing geodatabase if it already existed. Another challenge was correctly populating a dictionary with city names and populations, which required careful use of search cursors and print statements for debugging. 

The process highlighted the importance of error handling, proper cursor management, and the use of print statements for tracking progress. These techniques ensured smooth execution of the script and accurate results. By completing these tasks, we gained practical experience in working with geodatabases and manipulating spatial data using Python and ArcPy, essential skills for GIS programming.




Wednesday, June 5, 2024

Module 4 - Geoprocessing




In Module 4, I was reacclimated into the ArcGIS geoprocessing framework, exploring its significance and utility in spatial data analysis. Geoprocessing involves a series of actions that manipulate geographic data to produce desired results. Within ArcGIS, geoprocessing enables spatial analysis, modeling, and task automation using various tools. These tools are categorized into five types, System Tools, Built-in Tools, Custom Tools, Model Tools, and Script Tools. During the lab assignment, I had hands-on experience with different geoprocessing tools, which proved to be immensely valuable. I utilized ModelBuilder to create a step-by-step process where the model aimed to clip soil data to a basin extent, filter unsuitable farming areas, and generate a final output displaying suitable farming zones. Additionally,  I created a Python script to work with hospital data. First, I added XY coordinates to a shapefile called "hospitals" from my student drive. Then, I made a 1,000-meter buffer around each hospital. Finally, I combined all the buffers into one feature using the Dissolve tool. This script helps organize and analyze hospital data more effectively.