[GIS] Creating a new integer field based on text in a different field – ArcGIS 10.1

arcgis-10.1arcgis-desktopfield-calculatorunique id

I need to create a new integer field based on another text field. All instances of a the same text string in the existing field should be assigned the same number (starting at number 1). Can I do this in field calculator? If so, how?

I'm a beginner code-wise.

EDIT: Here's a sample
enter image description here

Each place name should be assigned a number. The third column shows what I'd like as a result. This is so I can use Hawths tool BATCH FIXED KERNEL DENSITY ESTIMATOR which only works with number categories:

http://www.spatialecology.com/htools/bkde.php

NOTE: Although I'm using 10.1, I've tried the non-batch kernel density estimator and it works well, no hitches so expect / hope the batch kernel estimator will work too.

Best Answer

You could do this in the field calculator but, depending on how many different text values you have, this could get a bit tortuous. A different (and simpler) approach would be to create a look up table in NotePad or Excel containing two fields. The first field contains your unique text strings and the second is the integer code you want to relate to each one. Then save this as a CSV table, import it into your MXD and do a table join to relate the numeric value to your text values in your data.

EDIT:
You can speed up the creation of your table by getting ArcMap to spit out the unique values from your text field, then copy that into Excel and autofill the second column to generate the codes (unless you have specific values you need to ascribe).

Related Question