ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Fundamentals of field calculations

  • Performing calculations on feature geometry
  • Reasons the Field Calculator might be disabled
  • Advanced calculations with the Field Calculator

Entering values with the keyboard is not the only way you can edit values in a table. In some cases, you might want to perform a mathematical calculation to set a field value for a single record or even all records. Field Calculator in ArcMap lets you perform simple as well as advanced calculations on all or selected records.

In addition, you can calculate area, length, perimeter, and other geometric properties on fields in attribute tables.

Performing calculations on feature geometry

If you're working with an attribute table of a feature layer, you can easily calculate the area; perimeter; 3D perimeter; length; 3D length; coordinates of the centroid; coordinates of a point; minimum and maximum z-values; or coordinates of a start, end, or midpoint using the Calculate Geometry dialog box.

You can use the coordinate system of the data source or of the data frame when performing calculations. In addition, if one or more records are currently selected, only the selected records are calculated.

The following table shows the geometric properties you can calculate for different types of features:

AreaPerimeter3D perimeterLength3D lengthX-, y-, or z-coordinate of centroidX-, y-, or z-coordinate of pointX-, y-, or z-coordinate of start pointX-, y-, or z-coordinate of endpointX-, y-, or z-coordinate of midpointMin, max of z-coordinate

Polygon features

Available

Available

Available

Available

Available

Line features

Available

Available

Available

Available

Available

Available

Annotation features

Available

Point features

Available

Geometric properties that can be calculated for specific types of features
Note:

You can only calculate z-coordinates and 3D measurements of a feature if the feature is z-aware.

Geometry calculations in ArcGIS are planimetric—in other words, they take place in projected space, not spherical or geodesic space. You can only calculate the area, length, or perimeter of features if the coordinate system being used is a projected coordinate system. If the data source uses a geographic coordinate system, such as WGS 1984, and is therefore unprojected, you can use the projected coordinate system of the data frame to perform the calculations. Alternatively, you can project the data source.

Calculate Geometry works with any numeric or text field. For the most precise results, use a field of type double, with the desired number of decimal places. If you use an integer field, the result will be rounded up to a whole number. If you use a text field, you can include the unit abbreviation, choose the format, and so on, to easily create a ready-to-use field for labeling.

Reasons the Field Calculator might be disabled

If you find that the Field Calculator or Calculate Geometry commands are unavailable when you right-click a field, here are some things to check:

  • You right-clicked a field that is managed by ArcGIS and therefore cannot be edited manually. These include the ObjectID (OID or FID) field; the Shape_Length and Shape_Area fields for a geodatabase feature class; the Area, Perimeter, and <Coverage># fields for a point or polygon feature class in a coverage; and the FNODE#, TNODE#, LPOLY#, RPOLY#, Length, and <Coverage># fields for an arc feature class in a coverage.
  • The table's data source is read-only, write access can't be established to the folder or geodatabase, or the data source is a format that can't normally be modified in ArcMap. You also may be working with EDG or SDC data or ArcIMS services, which usually allow you to open their attribute tables but not modify the data.
  • You are not in an edit session and you need to be editing to calculate the data. For example, you must be in an edit session when working with versioned ArcSDE data or a feature class that participates in a geodatabase topology, a geometric network, or a relationship class.
  • The field belongs to a table that has been joined to your table. You can only calculate values for fields in the origin table.
  • The field may be a raster, BLOB, or Global ID type, which cannot be calculated. To review the type of a field, right-click it and click Properties.

Advanced calculations with the Field Calculator

The Field Calculator lets you perform advanced calculations using VBScript or Python code blocks that process the data before calculations are made on the selected field. For example, using demographic data, you might want to find the largest age group by percentage of the population for each county in the United States. You can create a script that preprocesses your data using logical constructs such as IF...THEN statements and Select Case blocks. This lets you perform sophisticated calculations quickly and easily.

Simple field calculator expressions are entered into the Expression text box directly. More complex expressions, such as multiline scripts, looping, and branching, are entered in the Code Block box on the Calculate Field tool dialog box.

Related topics

  • Making simple field calculations
  • Calculating area, length, and other geometric properties
  • Changing the case of text field values
  • Calculate Field examples

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2018 Esri. | Privacy | Legal