# Geometry service GetLengthsGeodesic method

The GetLengthsGeodesic 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 |

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 geodesic length of each polyline in the input array.

## Remarks

Use this method if you want to calculate a length using only the vertices of the polylines and define the lines between the vertices as geodesic segments independent of the actual shape of the polyline. A geodesic segment is the shortest path between two points on an ellipsoid.

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 first inverse projected into its associated geographic coordinate system and then the distance calculations are performed.