Calculate Lengths

The “lengths” operation allows to remotely calculate the length of each polyline specified by the user.

Example of request:

http://galileo.icc.cat/arcgis/rest/services/Utilities/Geometry/GeometryServer/lengths?f=json&polylines=[{"paths":[[[436750,4617788.333892822],[431250,4619988.333892822],[337200,4618888.333892822],[284400,4606238.333892822],[295950,4603488.333892822]]],"spatialReference":{"wkid":23031}}]&sr=23031&lengthUnit=9001&geodesic=true&token=WgTR74xQdSvkHVECel6pSEijFKWafsP3g9DLA8WYg1sD3ycDBOx4g-Vj_i4xHhus

and related response:

{"lengths":[166166.47962766109]}

Service parameters

Parameter

Description

f

Response format

Valid values: html | json
Default value: html

polylines

Array of polylines whose lengths want to be determined.  The syntax of this parameter should be:

[, ]

sr

Reference system identifier used to describe polygons.

lengthUnit

Unity in which the length is to be expressed. See the list of possible values

calculationType 

Reference system identifier used to describe the affected area. If not specified, the one indicated as  inSR is taken by default.

distances

Type of calculation required to determine the length

Valid values:      planar | geodesic | preserveShape.

Default value:   preserveShape

planar: calculation that express geometries such as polygons on a flat surface

geodesic: calculations based on the vertices of the polygon, defining the lines between them as geodetic segment  (shorter lines between two points on the Earth ellipsoid) independent of the specific polygon forms.

preserveShape: calculation expressing geometries (vertices and lines between them) on the Earth ellipsoid surface.

token

Required security key in order to perform this function which is generated by filling in the corresponding form.

Additional information

Usage example