Posts

Showing posts from June, 2020

Lab 6 [GIS5103]: Working with Geometries

Image
The screenshot above shows the output from this week's lab where skills emphasizing working with geometry objects were addressed. In the output above these skills were used to read a shapefile and then write specific information on each feature to a text file. The items on each line in the output file included the object ID number, vertex count number, X coordinate, Y coordinate, and feature name. The general pseudocode was as follows: Start     Step 0: (Setup)     Setup input filepath     Setup output filepath     Step 1: (Prepare output file)     Create output filename     Open output file for writing      Step 2: (Write details to output file)     Create search cursor to extract OID@, SHAPE@, NAME for each feature     Iterate through each row/feature in cursor         Set vertexID to 0         Iterate through the points in each feature (using getPart)             Increment vertexID by 1 (starts count at 1 for each set of vertices)            

Lab 5 [GIS5103]: Exploring and Manipulating Data

Image
The screenshots above represent the output from a multi-part Python script that performs the following steps: Step 1: Create and initialize a new geodatabase Step 2: Create a Search Cursor for cities associated with county seats Step 3: Create and initialize a dictionary for cities associated with county seats The initial pseudocode for these script requirements included: START     Step 1:             Setup filepath naming     Create new geodatabase     Iterate over features in Data:          Copy feature from Data folder into new geodatabase          Print name of copied feature to screen     Step 2:     Setup filepath naming     Setup field list of specific attributes within cities feature (NAME, FEATURE, POP_2000)     Use search cursor to grab a copy of specified attributes associated with cities listed as 'County Seat'     Iterate over search cursor:         Print attributes of each record to screen     Step 3:     Setup filepa

Lab 4 [GIS5103]: Geoprocessing

Image
The screenshot above provides the output from a Python script created this week to process a shapefile containing the locations of hospitals around the University of Texas at Austin, as shown here for part of this map: A 1000-meter buffer was created around each hospital location, and then these overlapping buffer regions were dissolved into a separate, single feature, as shown here for the final output around the same area shown above: An overview of the major steps in the overall workflow is provided here: Overview of Major Steps in Overall Workflow: STEP 0 : verify licensing, extensions, and input file hospitals.shp available STEP 1 : hospitals.shp à add XY coordinates à produce hospitalsXY.shp STEP 2 : hospitalsXY.shp à perform buffering à produce hospitalsXY_buffered.shp STEP 3 : hospitalsXY_buffered.shp à perform dissolving à produce hospitalsXY_buffered_dissolved.shp Key ArcPy functions explored this week for error handling

Lab 3 [GIS5103]: Debugging and Error Handling

Image
In this week's lab we examined the templates for three separate Python scripts to identify syntax errors and exceptions and how best to locate these using Spyder. The output from the first script that prints out the names of fields from a shapefile is shown here: Identifying the syntax errors within this script emphasized the importance of consistency with variable naming and the correct format for iterating with a for loop. The second script was designed to display a more complete set of items from an ArcGIS project file, including spatial reference information and layer information, as shown here: Systematically identifying the syntax errors in this script emphasized the importance of file path naming and consistency with variable name capitalization, as well as understanding the relevance of correctly formatting and spelling method names. A third and final script provided training in using the try-except statement, as shown in the following flowchart: