- URL:
- https://<root>/Utilities/Geometry/GeometryServer/lengths
- Methods:
GET
- Version Introduced:
- 9.3
Description
The lengths
operation is performed on a geometry service resource. This operation calculates the 2D Euclidean or geodesic length of each polyline specified in the input array. You can provide arguments to the lengths
operation as query parameters defined in the following parameters table.
Request parameters
Parameter | Details |
---|---|
| Specifies the array of polylines whose lengths are to be computed. The spatial reference of the polylines is specified by Syntax
Example
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. The expected format of the file's contents will be the same as that expected if the polylines were directly embedded in the request. URL-based syntax
URL-based example
|
| Specifies the well-known ID (WKID) of the spatial reference or a spatial reference JSON object for the input |
| Specifies the unit in which the lengths of polylines are calculated. If For a list of valid units, see esriSRUnitType Constants and esriSRUnit2Type Constants. |
| If |
| Defines the length calculation for the geometry. The type can be one of the following values:
|
| The response format. The default response format is Values: |
Example usage
The following is a sample request URL for lengths
. In this example, the lengths of two input polylines are calculated. The preserve
calculation type is used. The result unit is kilometers.
https://sampleserver6.arcgisonline.com/ArcGIS/rest/services/Utilities/Geometry/GeometryServer/lengths?sr=4269&polylines=[{"paths":[[[-117,34],[-116,34],[-117,33]],[[-115,44],[-114,43],[-115,43]]]},{"paths":[[[32.49,17.83],[31.96,17.59],[30.87,17.01],[30.11,16.86]]]}]&lengthUnit=9036&calculationType=preserveShape&f=pjson
JSON Response syntax
{
"lengths": [<length1>, <length2>, ..., <lengthN>]
}
JSON Response example
{
"lengths": [
456.04101753137257,
277.29464412330174
]
}