Skip to content

Instantly share code, notes, and snippets.

@jmcbroom
Last active August 29, 2015 14:14
Show Gist options
  • Save jmcbroom/e948b50faa725e7ee311 to your computer and use it in GitHub Desktop.
Save jmcbroom/e948b50faa725e7ee311 to your computer and use it in GitHub Desktop.
field calculator stuff
#### for everywhere BUT detroit
# in pre-script codeblock
rec=0
def autoIncrement(cityid):
# get something to add the incremented number to
citystart = cityid * 10000
global rec
pStart = 1
pInterval = 1
if (rec == 0):
rec = pStart
else:
rec += pInterval
final = citystart + rec
return final
# in the field calculator
autoIncrement(CITY_ID)
#### for Detroit
# in codeblock
rec=0
def autoIncrement(neighborhood):
# get something to add the incremented number to
detstart = (8000 + neighborhood) * 10000
global rec
pStart = 1
pInterval = 1
if (rec == 0):
rec = pStart
else:
rec += pInterval
final = detstart + rec
return final
# in the field calculator
autoIncrement(SAN00)
# refer to http://support.esri.com/en/knowledgebase/techarticles/detail/38517
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment