Create List of Unique Table Values using Python for ArcGIS Analysis

Necessity is the mother of invention and as of late, this means I have learned to use Python with ArcGIS. Early on, an issue I ran across was needing a list of all unique values in a field to be used in further analysis. Unfortunately there is not a pre-built method for this. Still, it did not take long to figure out the following function to accomplish this.


# Return list all permutations of field in input feature class or table
def getValueList (inputTable, field):

    valueList = [] # array to hold list of values collected
    valueSet = set() # set to hold values to test against to get list
    rows = arcpy.SearchCursor(inputTable) # create search cursor

    # iterate through table and collect unique values
    for row in rows:
        value = row.getValue(field)

        # add value if not already added and not current year
        if value not in valueSet:
            valueList.append(value)

        # add value to valueset for checking against in next iteration
        valueSet.add(value)

    # return value list
    valueList.sort()
    return valueList

Hopefully if you have run across this problem, you find this useful. If you know of a better method, please comment and let me know!

iTunes Playlists, Texas Country and Unleash the Redneck

While in the Dominican Republic over the last two weeks, I read Steve Jobs book. Interestingly enough, after reading Steve’s book, I felt a need to start organizing some personal soundtracks for life. That, and buy a iPod Shuffle for some of these soundtracks. This morning I started organizing my first two playlists named, Texas Country and Unleash the Redneck.

Texas Country is exactly as it sounds. While living in Corpus Christi, Texas a few years back, I discovered a radio station only playing Texas artists and bands. My old ’96 Toyota Tacoma rarely was tuned to very much else while down there. A month ago I stumbled across Reckless Kelly again on Pandora. Creating a station devoted to Reckless Kelly, I simply wrote down the other artists who sounded good, and got those through iTunes. A few of the artists in this playlist include:

  • Reckless Kelly
  • Steve Earle
  • Cross Canadian Ragweed
  • Ray Wylie Hubbard
  • Buddy Miller
  • Chris Knight
  • No Justice
  • Shooter Jennings

Unleash the Redneck, songs included in this playlist had to evoke a certain emotion. These are the kind of songs that, when they come on the radio, there is only one thing to do. Roll the windows down in my pickup. Reach down and twist the knob on the radio to turn the volume up…way up. Grab the stick. Mash the clutch. Grab another gear. Bury the gas pedal and drive it like you stole it just for the fun of it. These songs are what happens when rock and country collide, and not surprisingly include a lot of Texas Country. Some of the songs include:

  • Copperhead Road – Steve Earle
  • Cadillac Ranch – Chris LeDoux
  • Amos Moses – Cross Canadian Ragweed
  • Papa Loved Mama – Garth Brooks
  • Dumas Walker – Kentucky Headhunters
  • If You Want To Get To Heaven – Ozark Mountain Daredevils
  • A Guy Like Me – Reckless Kelly
  • Busted in Baylor County – Shooter Jennings
  • Beer for My Horses – Toby Keith
  • Old Enough to Know Better – Wade Hayes

Next I may have to put together a good collection of what has been described as, “Angry White Boy Music,” in honor of a good friend and college teammate, Owen Donahue getting engaged a couple of days ago (congratulations Owen!). Although I already knew of Mettalica, Owen made sure this was part of my higher education while at Mizzou. An angry white boy playlist could prove motivational for those early morning January and February paddles.

Learn LiDAR Principles

LiDAR, if you work in GIS and pay any attention to digital elevation model (DEM) data, you have heard of LiDAR. Although many people know it has something to do with bouncing light off terrain and it is very accurate, many times knowledge ends there. Fortunately there is an outstanding resource for learning about LiDAR.

The USGS put together this very well organized resource. Although it focuses on applications of LiDAR for natural resources, over 75 percent of the lesson focuses on data collection methods, factors of accuracy and other technical aspects of LiDAR applicable to anybody who uses LiDAR data. Fully narrated with animated visual aids it is a great resource, one I highly recommend.

Beating Lack of Hotel Wireless = Connectify + iPad

Netflix on the iPad is great for traveling. When coupled with the HDMI connector, it works great for streaming entertainment on the hotel flat screen televisions. Many times though, there is a problem. The iPad only does wireless. It does not get along well with a Cat6 cable. There is internet in the room, via a Cat6 cable. This does little good in getting Netflix from Al Gore’s Internet to the flat screen television though. This is where Connectify for Windows comes in. Within five minutes of downloading Connectify for free, my iPad was connected with Netflix streaming to the television watching something very useful like My Cousin Vinny.

Teaching Paperless with GoodReader on the iPad

Yes, I am a geek. This I will freely concede. Just before Christmas I looked seriously at the iPad, but decided to wait in lieu of the second generation soon to come out. Among the reasons this was interesting to me was the possibility of going paperless when traveling and teaching GIS.

Typically when traveling and teaching, I am carrying at least two books, the lecture and exercise books for the class. Many times I am teaching back to back classes, upping this count to four. If it is a more technical class, many times I grab a good reference too, adding another to the mix. It does not take long before my backpack is holding five books, a laptop and all the associated peripherals for working on the road with a laptop. As you can easily imagine, this can become quite a load.

When purchasing my iPad2, one of the first workflows I started exploring was how to get all my materials onto the iPad. Already I have access to most of my references and course materials in pdf format. The difficulty was figuring out how to get them onto the iPad and manage them once there. GoodReader was the answer.

GoodReader allows synchronization with a multitude of server types not only at the file, but also at the directory level. Since I use MobileMe, this means all I have to do is keep all my course materials in a directory together. If I need to add or remove something, all I have to do is change the content on the server. These changes automatically are also performed on my iPad, making file management infinitely easier.

In addition to the file management capabilities, this sync functionality applies to individual files as well. Since GoodReader facilitates notes, highlights and annotations in the pdf documents, these changes are automatically synced back up to the documents on the server where I can access and view them on my desktop. GoodReader, it answers on part of my goal toward moving increasingly paperless at work with the iPad as part of this plan.