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

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

NameSummary
new DistanceParameters()Creates a new DistanceParameters object.

Properties

NameTypeSummary
distanceUnitNumber | StringSpecifies the units for measuring distance between geometry1 and geometry2.
geodesicBooleanWhen true, the geodesic distance between geometry1 and geometry2 is measured.
geometry1GeometryThe geometry from which the distance is to be measured.
geometry2GeometryThe geometry to which the distance is measured.
Constructor Details

new DistanceParameters()

Creates a new DistanceParameters object. The constructor takes no parameters.
Sample:
require([
  "esri/tasks/DistanceParameters", ... 
], function(DistanceParameters, ... ) {
  var distParams = new DistanceParameters();
  ...
});
Property Details

<Number | String> distanceUnit

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; 
  ...
});   

<Boolean> geodesic

When true, the geodesic distance between geometry1 and geometry2 is measured.
Known values: true | false
Default value: false
Sample:
distParams.geodesic = true; 

<Geometry> geometry1

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]; 

<Geometry> geometry2

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];

Show Modal