Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: AreasAndLengthsParameters

require(["esri/tasks/AreasAndLengthsParameters"], function(AreasAndLengthsParameters) { /* code goes here */ });

Description

(Added at v2.0)
Input parameters for the areasAndLengths() method on the Geometry Service. Sets the lengthunits,areaUnit and other parameters.

Samples

Search for samples that use this class.

Constructors

NameSummary
new AreasAndLengthsParameters()Creates a new AreasAndLengthsParameters object.

Properties

NameTypeSummary
areaUnitNumber | StringThe area unit in which areas of polygons will be calculated.
calculationTypeStringDefines the type of calculation for the geometry.
lengthUnitNumber | StringThe length unit in which perimeters of polygons will be calculated.
polygonsPolygon[]Polygon geometries for which to compute areas and lengths.
Constructor Details

new AreasAndLengthsParameters()

Creates a new AreasAndLengthsParameters object.
Property Details

<Number | String> areaUnit

The area unit in which areas of polygons will be calculated. See the constants table of GeometryService for a list of valid values.
Sample:
require([
  "esri/tasks/AreasAndLengthsParameters", "esri/tasks/GeometryService", ... 
], function(AreasAndLengthsParameters, GeometryService, ... ) {
  var areasAndLengthParams = new AreasAndLengthsParameters();
  areasAndLengthParams.areaUnit = esri.tasks.GeometryService.UNIT_ACRES;
  ...
});

<String> calculationType

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:

areasAndLengthParams.calculationType = 'preserveShape';

<Number | String> lengthUnit

The length unit in which perimeters of polygons will be calculated. See the constants table of GeometryService for a list of valid values.
Sample:
require([
  "esri/tasks/AreasAndLengthsParameters", "esri/tasks/GeometryService", ... 
], function(AreasAndLengthsParameters, GeometryService, ... ) {
  var areasAndLengthParams = new AreasAndLengthsParameters();
  areasAndLengthParams.lengthUnit = GeometryService.UNIT_FOOT;
  ...
});

<Polygon[]> polygons

Polygon geometries for which to compute areas and lengths
Sample:
geometryService.simplify([geometry], function(simplifiedGeometries) {
  areasAndLengthParams.polygons = simplifiedGeometries;
  geometryService.areasAndLengths(areasAndLengthParams);
});
Show Modal