GIS Logo GSP 118 (318): GIS Programming

Assignment: Creating Tools and Accessing Attributes

1. An Attribute Analysis Tool

We use attributes for a wide variety of analysis tasks. Using Python, you can access attributes, compute statistics from them, and combine them with other information in new an exciting ways.

Data needed:

  • You can use the shapefile for Oregon dams (available at: Oregon Dams Geodatabase) or another shapefile that contains an attribute column with a range of numeric values. Your script should work with any shapefile that contains a column of numeric values (integers or floating-point).

Create a tool for ArcGIS that allows the user to select a Shapefile, a field (attribute) within the shapefile, and computes the: number of values, total of all values, and the mean value. The tool should then display a dialog box with the result.

It's up to you how you structure the script with functions and modules. I highly recommend you try the script with a few shapefiles to make sure it works. Think about potential problems that you may want to provide error checking for.

Your tool will need to:

  • Get information from the user
  • Compute the values for the selected row
  • Display the results in a window for the user to see
Note: Remember to place the overall script in a "try/except" block and fully document all files.

 

Turn-in:

  1. Finished Python script with any associated modules I'd need to run it as if I was a user you were giving the script to.
  2. Extra credit: create a histogram and display it in a window.