Home arrow GIS Data & Resources arrow Scripts and Code arrow Python arrow Python! Temporal renderer...
Python! Temporal renderer... PDF Print E-mail

Written by Kevin Bell,


Do you ever need to display the temporal aspect of features?  We have traffic studies all over the city, and it's nice to color code them based on their age.  There isn't an "age" renderer that you can use, but you can calculate a new field as a number representing the number of days since some abrbitrary point in the distant past and then use one of the Quantity renderers like Graduated Colors to symbolize old features and new on color ramp! 

from mx import DateTime as dt
import arcgisscripting
gp = arcgisscripting.create(9.3)


def convertDate(theDate):
    '''use mx.DateTime to get COM days since epoch.  MS Access needs this format'''
    m,d,y = theDate.split('/')  # date format is mm/dd/yyy
    d = dt.Date(int(y), int(m), int(d))
    return d.COMDate()


fc = r"C:\StagingDBs\slcdot.gdb\trafficStudies\volumes"

cur = gp.updatecursor(fc)
row = cur.next()
while row:
    aDate = row.STARTDATE
    if aDate:
        seqDate = convertDate(aDate)
        row.dateCode = seqDate
        cur.UpdateRow(row)
        row = cur.next()
    else:
        row = cur.next()

del cur
del gp

print " ALL DONE"



Users' Comments  
 

No comment posted

Add your comment

07, Oct. 2008
Last Updated ( 07, Oct. 2008 )
 
< Prev   Next >

AGRC Contacts | UGIC Contacts

feed image feed image

Utah GIS Portal © 2009 AGRC

Optimized for