# Geometry service GetLengthsPreserveShape method

The GetLengthsPreserveShape method calculates geodesic length for each input polyline allowing for specification of output units.

GetLengthsGeodesic (SpatialReference SpatialReference, Polyline[] InPolylineArray, LinearUnit LengthUnit)

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

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

InPolylineArray | The array of Polylines on which the length will be calculated. All geometries are assumed to be in the coordinate system defined by SpatialReference. |

LengthUnit | (optional) The unit of measure in which lengths will be returned. |

## Return Value

A double[] containing the length of each polyline in the input array.

## Remarks

The GetLengthsPreserveShape method preserves the shape of each input polyline as it appears in its coordinate system and calculates the length of the polyline on the surface of the Earth.

The returned lengths are expressed in the
specified linear units, if present, or in the units of the spatial
reference. If *LengthUnit* is not specified and the input spatial
reference is a geographic coordinate system, then the lengths are
expressed in meters. This method calculates the ellipsoidal
shortest path distance between each pair of the vertices in the
polylines.

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