dojo.require("esri.tasks.LengthsParameters")
Description
(Added at v2.0)
Sets the length units and other parameters for Lengths operation.
Samples
Search for
samples that use this class.
Constructors
Properties
calculationType | String | Defines the type of calculation for the geometry. |
geodesic | Boolean | If polylines are in geographic coordinate system, then geodesic needs to be set to true in order to calculate the ellipsoidal shortest path distance between each pair of the vertices in the polylines. |
lengthUnit | Number | String | The length unit in which perimeters of polygons will be calculated. |
polylines | Geometry[] | The array of polylines whose lengths are to be computed. |
Constructor Details
Creates a new LengthsParameter object.
Sample:
var lengthParams = new esri.tasks.LengthsParameters();
Property Details
Defines the type of calculation for the geometry. The type can be one of the following:
- planar: Planar measurements use 2D Cartesian mathematics to calculate length. Use this type if the length needs to
be calculated in the input spatial reference otherwise use
preserveShape
.
- geodesic: Use this type to calculate an area or length using only the vertices of the polygon to define the lines connecting the vertices as geodesic segments independent of the actual shape of the polygon. Note: a geodesic segment is the shortest path between two points on an ellipsoid.
- preserveShape: Calculate the area or length of the geometry on the surface of the Earth ellipsoid, for geometries defined in a projected or geographic coordinate system. This method preserves the shape of the geometry in its coordinate system which means the true area or length will be calculated for the geometry that is displayed on the map.
Requires ArcGIS Server 10.1 or greater (Added at v3.0) Sample:
lengthParams.calculationType = 'preserveShape';
If polylines are in geographic coordinate system, then geodesic needs to be set to true in order to calculate the ellipsoidal shortest path distance between each pair of the vertices in the polylines. The output if lengthUnit if not specified is returned in meters.
Note:If you are using an ArcGIS Server 10.1 or greater then use the calculationType
property instead.
Known values: true | false
Sample:
lengthParams.geodesic = true;
The length unit in which perimeters of polygons will be calculated. See the constants table of
GeometryService for a list of valid values.
Sample:
lengthParams.lengthUnit = esri.tasks.GeometryService.UNIT_METER;
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.
Sample:
lengthParams.polylines = [geometry];