FRAMES | NO FRAMES Description | Parameters | Examples | Response
Lengths (Operation)
URL http://<geometryservice-url>/lengths
Parent Resource Geometry Service


The lengths operation is performed on a geometry service resource. This operation calculates the lengths of each polyline specified in the input array.

You can provide arguments to the lengths operation as query parameters defined in the parameters table below.


Parameter Details
f Description: The response format. The default response format is html.

Values: html | json
polylines Description: The array of polylines whose lengths are to be computed. The spatial reference of the polylines is specified by sr. The structure of each polyline in the array is same as the structure of the JSON polyline objects returned by the ArcGIS REST API.

Syntax and Examples:

JSON Structures:



  "paths" : [
  "paths" : [

URL based:

For a large set of geometries, you can specify a URL to the input geometries stored in a JSON structure in a file on a public server.

Syntax: polylines={ "url" : "<URL to file>" }
Example: polylines={ "url" : "http://myserver/mygeometries/afile.txt" }

sr Description: The well-known ID of the spatial reference of the input polylines. For a list of valid WKID values, see Projected coordinate Systems and Geographic coordinate Systems.

Example Usage

Example 1: In this example, the length of the input polyline is calculated.

JSON Response Syntax

"lengths" : [ <length1>, <length2> ]

JSON Response Example

"lengths" : [ 4.82842712474619, 2.59117518742993 ]