Geometry service GetAreasAndLengths2 method

Calculates area and perimeter length for each polygon, allowing specification of output units.

GetAreasAndLengths2(SpatialReference SpatialReference, Polygon[] InPolygonArray, LinearUnit LengthUnit, LinearUnit AreaUnit, esriAreaUnits AreaUnitEnum, out double[] Lengths)

Parameter

Description

SpatialReference

The SpatialReference of the geometries in the InPolygonArray. Cannot be null.

InPolygonArray

The array of Polygons on which area and boundary length will be calculated. All geometries are assumed to be in the coordinate system defined by SpatialReference.

LengthUnit

(optional) Output lengths are expressed in this unit of measure.

AreaUnit

(optional) Output areas are expressed in this (squared) unit of measure.

AreaUnitsEnum

(optional) Output areas are expressed in this unit of measure. Some units (such as acres) can be specified by using this parameter instead of AreaUnit which is always a squared linear unit.

Lengths

A double[] containing the boundary length (perimeter) for each polygon in the input array. The variable is populated when the method is called.

Return Value

A double[] containing the area for each polygon in the input array.

Remarks

The area and length values are computed in the units specified as input parameters. If LengthUnit is not specified, then lengths are reported in the units of the input spatial reference.

If AreaUnit is not specified (i.e. its nil) then AreaUnitEnum is used if its value is other than esriAreaUnitsUnknown, otherwise the (squared) units of the input spatial reference are used.

It is not recommended that this method be used on geometries having latitude-longitude coordinates, since the length would then be calculated in units of "degrees" and the area would be calculated in units of "square degrees". Use the GetAreasAndLengthsGeodesic, the GetAreasAndLengthsPreserveShape, or the GetLengthsGeodesic methods to compute areas and lengths for geometries with latitude-longitude coordinates.

2/28/2020