### Description

This command adds a new area and/or perimeter field to a polygon data source. The tool can also perform on-the-fly unit conversion if the coordinate system of the data source is defined. The default is to write the area or length values in the coordinate system units (e.g. meters for UTM data). This default option does not require that a coordinate system is defined. The unit conversions available are area unit conversions between meters, feet, hectares, acres, kilometers and miles, and the length unit conversions available are between meters, kilometers, miles and feet.

It is not appropriate to use this tool with data in a geographic coordinate system (spherical coordinates require different algorithms to calculate areas and distances). If the tool detects a geographic coordinate system it will raise an error and will not process the command. However, if the coordinate system is not defined the tool is unable to determine whether it is a geographic coordinate system or not, so will process the command even though it creates nonsensical results. It is highly recommended that you reproject your data if you wish to use any of these tools (none of them are designed to accommodate spherical coordinates).

Note that if the area/perimeter field(s) specified already exist then an error will be returned unless you have specified the update=TRUE option.

See also: field.delete

### Syntax

addarea(in, [area], [perim], [areaunits], [perimunits], [update], [where]);

in | the input polygon data source | |

[area] | the name of the area field to add or replace | |

[perim] | the name of the perimeter length field to add or replace | |

[areaunits] | the area units (see help for details); the coordinate system must be defined to use this option (default=csu (coordinate system units); options: csu, m^2, km^2, mi^2, ft^2, hect, acre) | |

[perimunits] | the perimeter length units (see help for details); the coordinate system must be defined to use this option (default=csu (coordinate system units); options: csu, m, km, mi, ft) | |

[update] | (TRUE/FALSE) if TRUE and you specify an existing field the existing field will be updated rather than generating an error message (default=FALSE); warning: this option will result in overwriting of existing data and is therefore potentially dangerous. | |

[where] | the selection statement that will be applied to the feature data source to identify a subset of features to process (see full Help documentation for further details) |

### Example

addarea(in="C:\data\lakes.shp", area="AREA");

addarea(in="C:\data\lakes.shp", area="ACRES", perim="PERIM_KM", areaunits="acre", perimunits="km", where="COUNTY='WOOD' AND MONTH=7", update=TRUE);