Using the Attribute Table Field Calculator in Arcmap desktop 10.2

In this post, we will use the attribute table field calculator to derive values to populate new fields on the attribute table.

The sample dataset is a polygon shapefile of administrative units in Africa and a point feature shapefile of the most populated cities in Africa. Add the sample dataset to the map. In the Table of Contents on the left pane-Right Click on the Point feature layer and select Open Attribute Table from the drop down list.

Capture-1

Click on the red boxed drop down button and select Add Field (cursor finger position) to create a new attribute field on the table.

Capture-2

The Add Field dialog box pops up. Give the field a name and select a Type-whether integer for whole numbers or text for alphabets etc. For the demonstration, short integer is selected. Click OK and the new field is added to the attribute table.

Capture-4

The new attribute field –per_urban- was created to house the percentage of the ratio of the urban population against the population of each country where the urban area is situated in.

image

Right Click on the attribute field and Choose Field Calculator from the drop down menu.

(Note: It is better to use the Field Calculator when in a editing mode. This will allow for changes to be made in the event that mistakes were made).

image

In the Field Calculator window, write the VB Script that as [urban_area]/[country_po]*100. Simply interpreted as populate the field – per_urban with the values in the field-urban_area divided by the values in the column multiplied by a 100.

image

The result (red boxed) is shown on the attribute table in the screenshot below. Note that when the attribute field-per_urban was created, the field type was given as a short integer. This will allow the percentage round up to whole numbers leaving no decimal places. Save edits before closing the attribute table.

image

In the Table of Contents-Right Click on the Point feature layer. Choose Properties on the drop down list.

Capture-12

Click on Symbology tab and select Categories on the left pane under Features > Graduated colors and classify the newly created attribute field-per_urban.

Capture-15

On the map window we can visualize the different classes created.

Capture-16

You can use the field calculator for other types of functions which are not mathematical or numeric in nature. We will deal with more complex use of the attribute field calculator in ArcMap in later posts. We hope you enjoyed this post.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s