Module 6 - Working with Geometries: Extracting Vertex Coordinates from Line Features

The final module of GIS Programming had us write a script that extracts every vertex from a set of river/stream line features (Hawaii stream data) and writes them out to a text file. One line per vertex, containing the feature's OID, a vertex ID, the X/Y coordinates, and the stream's name.

The core of the script is a nested loop: an outer SearchCursor loop iterates over each river feature (row), and an inner loop walks through every point in that feature's geometry (row[1].getPart(0)), incrementing a vertex counter as it goes. For each vertex, I built a formatted string with the OID, vertex ID, coordinates, and stream name, then wrote it to a text file and printed it to the console for verification. 


I hit one bug worth mentioning: I initially tried to pull the river's name using "NAME@" as the cursor field, which failed. The @ suffix in arcpy cursor fields is reserved for special geometry/identity tokens like "OID@" and "SHAPE@." NAME is a normal attribute field, not one of those tokens, so it just needed to be "NAME" on its own. It was a quick fix once I understood why it failed, instead of just matching a pattern I'd seen elsewhere in the script.

One small habit from this module I've kept since: instead of writing the output string directly into both the write() and print() calls, I assigned it to a single variable (txtFormula) first and used that variable in both places. That way, if I needed to change the output format while debugging, I only had to edit one line instead of keeping two copies in sync.



Module 5 - Exploring & Manipulating Data

This module's script had three parts: create a new file geodatabase, copy an existing set of shapefiles into it, then use search cursors to extract and reorganize data from one of those feature classes. First as a filtered printout, then as a populated dictionary.


The first part used CreateFileGDB_management() to create the geodatabase, then looped through every feature class in the source workspace with CopyFeatures_management(), printing a success message and elapsed time for each copy, which is useful for confirming nothing silently failed partway through a batch operation.


The second part used a SearchCursor with an embedded SQL where-clause to pull only the "County Seat" features out of a cities shapefile, printing each city's name, feature type, and circa-2000 population. One thing I noticed working with the data: a few cities show a population of -99999, which is a placeholder for missing/unavailable data rather than an actual value, which is worth flagging if this feature class were used downstream, since a naive average or sum would be badly skewed by it.


This part of the script uses SQL within the SearchCursor to only search for County Seat feature types within the cities attribute table. Using row.getValue() and defined variables, I was able to print each set of data. Below is a summarized flowchart of this section of the script.


The third part is where I hit the most interesting bug of the module. I needed to populate a dictionary (county_seats) using the same cursor logic, but it kept returning an empty dictionary. My first guess was a workspace path issue, which I fixed, but the dictionary still only returned a single entry ({'Carlsbad': 25625}) instead of the full set. I'd assumed that deleting the cursor's current row (del row) was sufficient cleanup between cursor uses, but the real issue was that I hadn't deleted the cursor object itself. Python was holding onto the exhausted cursor from the previous step, so the new loop had nothing left to iterate over. Once I deleted the cursor properly and re-created a fresh one for this step, the dictionary populated correctly with all city entries.


I ended up using the <dictionary_variable>[key] = value method to populate the county_seats dictionary. This final part of the script has a similar flowchart as part B does.

 

I also split one long print statement across multiple concatenated lines (city name / feature type / population) for readability. It was a small style choice, but one that made the script easier to scan when I came back to it later.


 

Module 4 - Geoprocessing

    This module's task was to build a Python script that runs a small spatial analysis pipeline on a hospitals shapefile: add XY coordinates, generate a buffer around each point, and dissolve the resulting buffers into a single feature.

    I structured the script in three stages. First, I used Copy_management() to duplicate the original hospitals shapefile before making any changes as I wanted the source data to stay untouched in case I needed to re-run or compare against it later. Then AddXY_management() added coordinate fields to the copy. Second, arcpy.analysis.Buffer() created a 1000-foot buffer around each hospital point. Third, arcpy.management.Dissolve() merged the buffers into a single output feature. I added arcpy.GetMessages() after each step so I could confirm success (or catch failures) at every stage. The terminal output below shows each step completing with its execution time.

 

    I originally used arcpy.management.Delete() to manually clear old outputs so I could re-run the script during testing. I realized that was the wrong tool as 'arcpy.env.overwriteOutput = True' does this automatically and is the standard way to allow geoprocessing outputs to be overwritten during iterative testing, so I switched to that instead.


Module 7 - Google Earth

     This final module focused on creating Google Earth maps and tours, as well as converting ArcGIS maps to the KML format. Starting off with a surface water feature layer, I used the "Layer to KML" geoprocessing tool to convert my map into a .kmz file for use in Google Earth. I then imported my converted file as well as the other provided .kmz files into Google Earth.


        I then created a tour of South Florida using the "Record a Tour" button through placemarks I added. I had some trouble navigating Google Earth as I am used to the inverse x and y camera controls.

Module 6 - Isarithmic Mapping

    For this module we were tasked to create an isarithmic map of Washington State's precipitation. An isarithmic map is used to depict smooth, continuous data such as elevation or precipitation. We were also shown the difference between Continuous Tone and Hypsometric Tinting for shading isarithmic maps.


     This map uses Hypsometric Tinting to assist in visualizing the zones between the precipitation contour lines. This allows for better visualization of the ten classes. We would use continuous tone to depict data if we wanted to visualize more precise variations.

    We can see in this map that the eastern side of the state receives remarkably less precipitation then the rest of the state, most likely due to the rain-shadow effect of the higher elevation mountains to the west.

Module 5 - Choropleth Mapping

     This week's module had us create a choropleth map of population density as well as a proportional symbol map of wine consumption by capita. For this map, I chose a purple color scheme because it is associated with luxury (wine) and it can also represent wine and grapes itself. The wine symbols are graduated symbols with 5 classes. 


     This module was challenging as I had issues finding a vector I liked for the wine consumption symbology. I ended up creating my own wine glass vectors using a phone app. I also struggled with lag in the ArcGIS Pro program, especially when I needed to adjust the symbology of layers or when I needed to adjust the country labels. 

    To create the Balkan countries' outline I selected the countries and exported them as a new feature. Then I used the 'Merge Tool' to merge them into a singular polygon. I chose the Natural Breaks classification method as I found that the data was naturally clustered and contained outliers. 

Module 4 - Data Classification

     This module had us create four map frames using ArcGIS, each with a different data classification type. The objective was for us to learn the differences between the Equal Interval, Quantile, Standard Deviation and Natural Break classification methods. 

    The Equal Interval classification method makes sure that the classes are split into equal ranges by using equal intervals. This method’s equal intervals allows for easier relative comparisons. The drawback is that the number of observations in each range will differ depending on the dataset, making it sensitive to outliers, which could be misleading.

    The Quantile classification method distributes the number of observations into ranges containing an equal number of each. This allows for each range to be equally represented on the map. This method is good at displaying ordinal data and it is less sensitive to outliers. The drawback of this method is that observations with widely different values could be placed into the same range.

     The Standard Deviation classification method is centered around the mean of the dataset, helping display data values that are close or far from the mean. This method is good at displaying variation and identifying outliers. The drawback of this method is that if the data is not nominal, it may not be as effective. 

    The Natural Break classification method helps to minimize the differences between observations and maximizes differences between ranges. This method is good for data with outliers since it considers how observations are clustered. The drawback of this method is that if the data is quite evenly distributed, then it may not represent it accurately.      

 


        


Module 3 - Cartographic Design

     This week's module involved the creation of a map that followed Gestalt's principles. I created a map of Washington D.C.'s Ward 7 public schools using ArcGIS. After adding all of the layers, I had to use the "Clip Tool" to create a layer that only included the D.C. schools located in Ward 7.

    As mentioned above, the objective of this module was for us to understand Gestalt's principles of Visual Hierarchy, Contrast, Figure Ground, and Balance. To establish Visual Hierarchy, I ranked schools based off of their type (High > Middle > Elementary) from large to small points. I also made my data source text size smaller so attention is not drawn away from the main map features.

    To achieve adequate contrast, I made sure to use a contrasting gradient for my point features. I chose bright colors that would stand out against the grays of the map. I made sure that the main roads (interstates, highways, etc.) were a darker gray than the local roads. I also made the background a darker shade than the map.

    To establish Figure-ground I made the Ward 7 area, the main area of interest, a lighter shade than the greater Washington D.C. area. And finally, I incorporated balance by making sure Ward 7 was sized as large as possible. Then I arranged the essential map elements (legend, scale, north arrow, sources) within the empty space in the bottom right corner.

Module 2 - Typography

     This week's module was centered around the typographic guidelines when making a map. The main objectives of this module were to properly label all of the map features in order for them to be distinguishable. We were tasked to depict some of Florida's natural features as well as some of it's county seats. I learned the proper uses of italic font types, as well as how to create annotations from labels in ArcGIS.

    In order to label the "Swamp or Marsh" features I had to change the symbology to "Unique", then used the "Create label classes from symbology..." tool in order to create separate label classes, otherwise the "Lake" and "Stream" features would have been labeled as well. 

    For my customizations I removed all the non-required city points to de-clutter the map (specifically to de-clutter South Florida). I reduced the halo size of the city labels to reduce the contrast of the labels to the base map. I made the “Swamp or Marsh” labels using the “Water – Large” label format and changed the colors to be a brighter green. I made sure that every font used was the same font, Arial, to maintain consistency throughout the map. I made the Tallahassee a red star to highlight its significance as the State Capital.