# Geometry service GetAreasAndLengthsPreserveShape method

The GetAreasAndLengthsPreserveShape method calculates area and perimeter for each input polygon while preserving its shape.

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

Parameter | Description |
---|---|

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

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

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

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

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 GetAreasAndLengthsPreserveShape method preserves the shape of each input geometry as it appears in its coordinate system and calculates the area or length of the geometry on the surface of the Earth.

The returned areas and lengths are expressed in
the specified area units and linear units, if present, or in the
units of the spatial reference. If *AreaUnit* and *LengthUnit* are not
specified and the input spatial reference is a geographic
coordinate system, then the lengths and areas are expressed in
meters.

The spatial reference can be a projected or a geographic coordinate system. If the former, then each geometry is inverse projected into its associated geographic coordinate system before the distance calculations are performed.