1

I am interested in using ArcGIS Pro's time aware capabilities to create a time aware map of the populated places for the state of Wyoming from the 1870 Census to the 2010 Census. In the end, I would like to be able to adjust the time slider to display the points using graduated symbols based on that population value which use the same method for every year (i.e. symbol size classifications remain constant over the entire range of time). Then I will publish to ArcGIS Online.

Currently, I have all of the places in a point feature layer in a geodatabase with fields containing population counts for every census during those years. It is my understanding that I need to add a time field and then replicate each feature for each census year which I have data for that specific feature and then add the population for that specific year.

Is this the correct approach and, if so, is there a simple way to produce this table? While there are not many cities in Wyoming there are still 15 decennial census over that time period so I would like to speed up this process by not manually moving these data.

  • I'm not sure I understand your second paragraph - are you saying you have a single point for each location, and then a field for the population of each census? e.g. POP1870, POP1880, POP1890 as separate fields for the single record? – Midavalo Jun 15 '16 at 20:33
  • That is correct. – SteveC Jun 15 '16 at 20:35
1

With arcpy you can automate the creation of a new feature class based on your existing one, moving population from year specific fields into a single field for population, and assigning the appropriate year into a new date field.

This creates a new Feature Class with 2 fields - Population and Year - and then loops through your different fields, and copies each feature and the appropriate population value and year into the new feature class.

You will need to name them appropriately in the fields and yearDict parameters where fields matches the actual fieldnames of your existing Population/Year fields, and yearDict has the year for each field.

You will also need to update with the path of your workspace/geodatabase and names of your existing and new feature classes.

import arcpy, datetime 

ws = arcpy.env.workspace = r'N:\GISSE\SE.gdb'
exFC = r'TimeSeriesPoints'
newFC = r'TimesSeriesPointsNew'

fields = ['Pop1870', 'Pop1880', 'Pop1890', 'Pop1900', 'Pop1910', 'Pop1920', 'Pop1930', 'Pop1940', 
          'Pop1950', 'Pop1960', 'Pop1970', 'Pop1980', 'Pop1990', 'Pop2000', 'Pop2010']
yearDict = {'Pop1870': 1870, 'Pop1880': 1880, 'Pop1890': 1890, 'Pop1900': 1900, 'Pop1910': 1910, 'Pop1920': 1920, 'Pop1930': 1930, 'Pop1940': 1940, 
            'Pop1950': 1950, 'Pop1960': 1960, 'Pop1970': 1970, 'Pop1980': 1980, 'Pop1990': 1990, 'Pop2000': 2000, 'Pop2010': 2010}

if arcpy.Exists(newFC):
    arcpy.Delete_management(newFC)
arcpy.CreateFeatureclass_management(ws, newFC, 'POINT', '', '', '', exFC)
arcpy.AddField_management(newFC, 'Population', 'LONG')
arcpy.AddField_management(newFC, 'Year', 'DATE')

exFields = [f.name for f in arcpy.ListFields(exFC)]

with arcpy.da.InsertCursor(newFC, ['SHAPE@', 'Population', 'Year']) as iCursor:
    for field in fields:
        if field in exFields:
            with arcpy.da.SearchCursor(exFC, ['SHAPE@', field]) as sCursor:
                for row in sCursor:
                    if row[1]:
                        yearValue = datetime.datetime.strptime("{}".format(yearDict[field]), '%Y')
                        pop = row[1]
                        iCursor.insertRow((row[0], pop, yearValue))

print "Done"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.