# Geometry service GetLengths2 method

The GetLengths2 method calculates the length of each input polyline while allowing for specification of output units.

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

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

SpatialReference |
The SpatialReference of the geometries in |

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 length values are computed in the specified linear units, if present, or in the units of the spatial reference. 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". You can use the GetLengthsGeodesic method to compute accurate lengths for polylines with latitude-longitude coordinates.