require(["esri/tasks/DistanceParameters"], function(DistanceParameters) { /* code goes here */ });
Description
(Added at v2.0)
Input parameters for the distance method on the GeometryService. Geometry1 and geometry2 are required.
Samples
Search for
samples that use this class.
Constructors
Properties
Constructor Details
Creates a new DistanceParameters object. The constructor takes no parameters.
Sample:
require([
"esri/tasks/DistanceParameters", ...
], function(DistanceParameters, ... ) {
var distParams = new DistanceParameters();
...
});
Property Details
Specifies the units for measuring distance between geometry1 and geometry2. See the constants table of
GeometryService for a list of valid values. If the unit is not specified the units are derived from the spatial reference.
Sample:
require([
"esri/tasks/DistanceParameters", "esri/tasks/GeometryService", ...
], function(DistanceParameters, GeometryService, ... ) {
var distParams = new DistanceParameters();
distParams.distanceUnit = GeometryService.UNIT_STATUTE_MILE;
...
});
When true, the geodesic distance between geometry1 and geometry2 is measured.
Known values: true | false
Default value: false
Sample: distParams.geodesic = true;
The geometry from which the distance is to be measured. The geometry can be one of the following geometry types: esriGeometryPoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryMultipoint
.
Sample:
distParams.geometry1 = inputPoints[inputPoints.length -2];
The geometry to which the distance is measured. The geometry can be one of the following geometry types: esriGeometryPoint, esriGeometryPolyline, esriGeometryPolygon or esriGeometryMultipoint.
Sample:
distParams.geometry2 = inputPoints[inputPoints.length -1];