Class: GeometryService

Description

dojo.require("esri.tasks.geometry");

Represents a geometry service resource exposed by the ArcGIS Server REST API. It is used to perform various operations on geometries such as project, simplify, buffer, and relationships. For more details on constant values, see esriGeometryRelationEnum.

Samples

Search for samples that use this class.  

Class hierarchy

esri.tasks.GeometryService

Constructor

Constructor Description
esri.tasks.GeometryService(url) Creates a new GeometryService object. A URL is a required parameter.

Properties

Property Type Description
url String URL to the ArcGIS Server REST resource that represents a locator service. To obtain the URL, use Services Directory.

Constants

Constant Description
UNIT_ACRES Acres (areal unit)
UNIT_ARES Ares (areal unit)
UNIT_FOOT International foot (0.3048 meters)
UNIT_HECTARES Hectares (areal unit)
UNIT_KILOMETER Kilometer
UNIT_METER International meters
UNIT_NAUTICAL_MILE Nautical Miles (1,852 meters)
UNIT_SQUARE_CENTIMETERS Square Centimeters (areal unit)
UNIT_SQUARE_DECIMETERS Square Decimeters (areal unit)
UNIT_SQUARE_FEET Square Feet (areal unit)
UNIT_SQUARE_INCHES Square Inches (areal unit)
UNIT_SQUARE_KILOMETERS Square Kilometers (areal unit)
UNIT_SQUARE_METERS Square Meters (areal unit)
UNIT_SQUARE_MILES Square Miles (areal unit)
UNIT_SQUARE_MILLIMETERS Square Millimeters (areal unit)
UNIT_SQUARE_YARDS Square Yards (areal unit)
UNIT_STATUTE_MILE Miles (5,280 feet, 1,760 yards, or exactly 1,609.344 meters)
UNIT_US_NAUTICAL_MILE US Nautical Mile

Methods

Method Return Value Description
areasAndLengths(areasAndLengthsParameters, callback?, errback?) dojo.Deferred Computes the area and length for the input polygons.
autoComplete(polygons, polylines, callback?, errback?) dojo.Deferred The Auto Complete operation is performed on a geometry service resource. The AutoComplete operation simplifies the process of constructing new polygons that are adjacent to other polygons. It constructs polygons that fill in the gaps between existing polygons and a set of polylines.
buffer(bufferParameters, callback?, errback?) dojo.Deferred Creates buffer polygons at a specified distance around the given geometries. On completion, the onBufferComplete event is fired and the optional callback function is invoked. Both the callback and event handlers receive an array of Geometry that contains the buffer polygons.
convexHull(geometries, callback?, errback?) dojo.Deferred The convexHull operation is performed on a geometry service resource. It returns the convex hull of the input geometry. The input geometry can be a point, multipoint, polyline or polygon. The hull is typically a polygon but can also be a polyline or point in degenerate cases.
cut(targetGeometry, cutterGeometry, callback?, errback?) dojo.Deferred The cut operation is performed on a geometry service resource. This operation splits the input polyline or polygon where it crosses a cutting polyline.
difference(geometries, geometry, callback?, errback?) dojo.Deferred The difference operation is performed on a geometry service resource. This operation constructs the set-theoretic difference between an array of geometries and another geometry.
distance(params, callback?, errback?) dojo.Deferred Measures the planar or geodesic distance between geometries.
generalize(params, callback?, errback?) dojo.Deferred Generalizes the input geomtries using the Douglas-Peucker algorithim.
intersect(geometries, geometry, callback?, errback?) dojo.Deferred The intersect operation is performed on a geometry service resource. This operation constructs the set-theoretic intersection between an array of geometries and another geometry.
labelPoints(polygons, callback?, errback?) dojo.Deferred Calculates an interior point for each polygon specified. These interior points can be used by clients for labeling the polygons.
lengths(lengthsParameter, callback?, errback?) dojo.Deferred Gets the lengths for a Geometry[] when the geometry type is Polyline.
offset(params, callback?, errback?) dojo.Deferred Constructs the offset of the input geometries.
project(geometries, outSpatialReference, callback?, errback?) dojo.Deferred Projects a set of geometries into a new spatial reference.
relation(relationParameter, callback?, errback?) dojo.Deferred Computes the set of pairs of geometries from the input geometry arrays that belong to the specified relation.
reshape(targetGeometry, reshaperGeometry, callback?, errback?) dojo.Deferred The reshape operation is performed on a geometry service resource. It reshapes a polyline or a part of a polygon using a reshaping line.
simplify(geometries, callback?, errback?) dojo.Deferred Alters the given geometries to make their definitions topologically legal with respect to their geometry type. On completion, the onSimplifyComplete event is fired and the optional callback function is invoked. Both the callback and event handlers receive an array of Graphic that contains the simplified geometries.
trimExtend(params, callback?, errback?) dojo.Deferred Trims or extend the input polylines.
union(geometries, callback?, errback?) dojo.Deferred The union operation is performed on a geometry service resource. This operation constructs the set-theoretic union of the geometries in the input array. All inputs must be of the same type.

Events

Event Description
onAreasAndLengthsComplete(areasAndLengths) Fires when the areasAndLengths operation is complete.
onAutoCompleteComplete(polygons) Fires when the autoComplete operation is complete.
onBufferComplete(geometries) Fires when the buffer operation is complete.

Version history:

  • Originally added: v1.0
  • graphics return value replaced by geometries: v2.0
onConvexHullComplete(geometry) Fires when the convexHull operation is complete.
onCutComplete(geometries) Fires when the cut operation is complete.
onDifferenceComplete(geometries) Fires when the difference operation is complete.
onDistanceComplete(distance) Fires when the distance operation is complete.
onError(error) Fires when an error occurs when executing the task.
onGeneralizeComplete(geometries) Fires when the generalize operation is complete.
onIntersectComplete(geometries) Fires when the intersect operation is complete.
onLabelPointsComplete(labelPoints) Fires when the labelPoints operation is complete.

Version history:

  • Originally added: v1.2
  • The return value of labelPoints changed from Graphic to Geometry: v2.0
onLengthsComplete(lengths) Fires when the lengths operation is complete.
onOffsetComplete(geometries) Fires when the offset operation is complete.
onProjectComplete(geometries) Fires when the project operation is complete.

Version history:

  • Originally added: v1.0
  • graphics return value replaced by geometries: v2.0
onRelationComplete(relationships) Fires when the relation operation is complete.
onReshapeComplete(geometry) Fires when the reshape operation is complete.
onSimplifyComplete(geometries) Fires when the simplify operation is complete.
onTrimExtendComplete(geometries) Fires when the trimExtend operation is complete.
onUnionComplete(geometry) Fires when the union operation is complete.
Constructor Detail

esri.tasks.GeometryService(url)

Creates a new GeometryService object. A URL is a required parameter.
Parameters:
<String> url Required URL to the ArcGIS Server REST resource that represents a geometry service. An example is http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Locators/ESRI_Geocode_USA/GeocodeServer. For more information on constructing a URL, see The Services Directory and the REST API.
Code snippets:
Properties Detail

<String> url

URL to the ArcGIS Server REST resource that represents a locator service. To obtain the URL, use Services Directory.
Methods Detail

areasAndLengths(areasAndLengthsParameters, callback?, errback?)

Computes the area and length for the input polygons.

Version history:

  • Originally added: v1.1
  • errback parameter added: v1.3
  • Return value of dojo.Deferred added: v1.4
  • graphics parameter replaced by AreasAndLengthsParameters: v2.0

Return value: dojo.Deferred
Input Parameters:
<AreasAndLengthsParameters> areasAndLengthsParameters Required Specify the input polygons and optionally the linear and areal units.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onAreasAndLengthsComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution. (As of v1.3)
Code snippets:
var areasAndLengthParams = new esri.tasks.AreasAndLengthsParameters();
areasAndLengthParams.linearUnit = esri.tasks.GeometryService.UNIT_FOOT;
areasAndLengthParams.areaUnit = esri.tasks.GeometryService.UNIT_ACRES;
geometryService.simplify([geometry], function(simplifiedGeometries) {
  areasAndLengthParams.polygons = simplifiedGeometries;
  geometryService.areasAndLengths(areasAndLengthParams);
});

See also:
onAreaAndLengthsComplete   onError  

autoComplete(polygons, polylines, callback?, errback?)

The Auto Complete operation is performed on a geometry service resource. The AutoComplete operation simplifies the process of constructing new polygons that are adjacent to other polygons. It constructs polygons that fill in the gaps between existing polygons and a set of polylines. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<Polygon[]> polygons Required The array of polygons that will provide some boundaries for new polygons.
<Polyline[]> polylines Required An array of polylines that will provide the remaining boundaries for new polygons.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onAutoCompleteComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.
See also:
onAutoCompleteComplete   onError  

buffer(bufferParameters, callback?, errback?)

Creates buffer polygons at a specified distance around the given geometries. On completion, the onBufferComplete event is fired and the optional callback function is invoked. Both the callback and event handlers receive an array of Geometry that contains the buffer polygons.
Return value: dojo.Deferred
Input Parameters:
<BufferParameters> bufferParameters Required Specifies the input geometries, buffer distances, and other options.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onBufferComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution. (As of v1.3)
Code snippets:
var params = new esri.tasks.BufferParameters();
params.geometries  = [ evt.mapPoint ];

params.distances = [ dojo.byId('bufferDistance').value ];
params.unit = esri.tasks.GeometryService.UNIT_KILOMETER;
params.bufferSpatialReference = new esri.SpatialReference({wkid: 32662});
params.outSpatialReference = map.spatialReference;
gsvc.buffer(params);

See also:
onBufferComplete   onError  

convexHull(geometries, callback?, errback?)

The convexHull operation is performed on a geometry service resource. It returns the convex hull of the input geometry. The input geometry can be a point, multipoint, polyline or polygon. The hull is typically a polygon but can also be a polyline or point in degenerate cases. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<Geometry[]> geometries Required The geometries whose convex hull is to be created.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onConvexHullComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.
See also:
onConvexHullComplete   onError  

cut(targetGeometry, cutterGeometry, callback?, errback?)

The cut operation is performed on a geometry service resource. This operation splits the input polyline or polygon where it crosses a cutting polyline. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<Geometry[]> targetGeometry Required The polyline or polygon to be cut.
<Geometry[]> cutterGeometry Required The polyline that will be used to divide the target into pieces where it crosses the target.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onCutComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.
See also:
onCutComplete   onError  

difference(geometries, geometry, callback?, errback?)

The difference operation is performed on a geometry service resource. This operation constructs the set-theoretic difference between an array of geometries and another geometry. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<Geometry[]> geometries Required An array of points, multipoints, polylines or polygons.
<Geometry> geometry Required A single geometry of any type, of dimension equal to or greater than the elements of geometries.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onDifferenceComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.
See also:
onDifferenceComplete   onError  

distance(params, callback?, errback?)

Measures the planar or geodesic distance between geometries. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<DistanceParameters> params Required Sets the input geometries to measure, distance units and other parameters.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onDistanceComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.
Code snippets:
var distParams = new esri.tasks.DistanceParameters();
distParams.distanceUnit = esri.tasks.GeometryService.UNIT_STATUTE_MILE;

distParams.geometry1 = inputPoints[inputPoints.length - 2];
distParams.geometry2 = inputPoints[inputPoints.length - 1];
distParams.geodesic = true;
geometryService.distance(distParams, function(distance) {
  dojo.byId('distanceDetails').innerHTML = distance;
});

generalize(params, callback?, errback?)

Generalizes the input geomtries using the Douglas-Peucker algorithim. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<GeneralizeParameters> params Required An array of geometries to generalize and a maximum deviation. Optionally set the deviation units.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onGeneralizeComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.

intersect(geometries, geometry, callback?, errback?)

The intersect operation is performed on a geometry service resource. This operation constructs the set-theoretic intersection between an array of geometries and another geometry. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<Geometry[]> geometries Required An array of points, multipoints, polylines or polygons.
<Geometry> geometry Required A single geometry of any type, of dimension equal to or greater than the elements of geometries.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onIntersectComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.
See also:
onIntersectComplete   onError  

labelPoints(polygons, callback?, errback?)

Calculates an interior point for each polygon specified. These interior points can be used by clients for labeling the polygons.

Version history:

  • Originally added: v1.2
  • Return value of dojo.Deferred added: v1.4
  • polygons parameter changed from an array of graphics to an array of geometries. v2.0

(As of v1.2)
Return value: dojo.Deferred
Input Parameters:
<Geometry[]> polygons Required The graphics to process.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onLabelPointsComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution. (As of v1.3)
Code snippets:
geometryService.labelPoints(geometries, function(labelPoints) {
 var font = new esri.symbol.Font("20px", esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_BOLDER);
  dojo.forEach(labelPoints, function(labelPoint) {
    var textSymbol = new esri.symbol.TextSymbol(
      "X: " + dojo.number.format(labelPoint.x) + ", Y: " + dojo.number.format(labelPoint.y),
      font, new dojo.Color([0, 0, 0])
    );
    var labelPointGraphic = new esri.Graphic(labelPoint,textSymbol);
    map.graphics.add(labelPointGraphic);
  });
});

See also:
onLabelPointsComplete   onError  

lengths(lengthsParameter, callback?, errback?)

Gets the lengths for a Geometry[] when the geometry type is Polyline.

Version history:

  • Originally added: v1.1
  • errback parameter added: v1.3
  • Return value of dojo.Deferred added: v1.4
  • graphics parameter replaced by lengthsParameter: v2.0
Return value: dojo.Deferred
Input Parameters:
<LengthsParameters> lengthsParameter Required Specify the polylines and optionally the length unit and the geodesic length option.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onLengthsComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution. (As of v1.3)
Code snippets:
var lengthParams = new esri.tasks.LengthsParameters();
lengthParams.polylines = [geometry];
lengthParams.lengthUnit = esri.tasks.GeometryService.UNIT_METER;
lengthParams.geodesic = true;
geometryService.lengths(lengthParams);

See also:
onLengthsComplete   onError  

offset(params, callback?, errback?)

Constructs the offset of the input geometries. If the offsetDistance is positive the constructed offset will be on the right side of the geometry. Left side offsets are constructed with negative values. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<OffsetParameters> params Required Set the geometries to offset, distance and units.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onOffsetComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.

project(geometries, outSpatialReference, callback?, errback?)

Projects a set of geometries into a new spatial reference. On completion, the onProjectComplete event is fired and the optional callback function is invoked. Both the callback and event handlers receive an array of Geometry[] that contains the projected geometries.

Version history:

  • Originally added: v1.0
  • errback parameter added: v1.3
  • Return value of dojo.Deferred added: v1.4
  • graphics parameter replaced by geometries: v2.0

Return value: dojo.Deferred
Input Parameters:
<Geometry[]> geometries Required The geometries to project.

Prior to version 2.0, the first parameter was

<Graphic[]> graphics Required The graphic to project.
<SpatialReference> outSpatialReference Required The well-known ID of a spatial reference.
{"wkid" : 4326} 
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onProjectComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution. (As of v1.3)
Code snippets:
gsvc.project([ point ], outSR, function(projectedPoints) {
  pt = projectedPoints[0];
});

See also:
onProjectComplete   onError  

relation(relationParameter, callback?, errback?)

Computes the set of pairs of geometries from the input geometry arrays that belong to the specified relation. Both arrays are assumed to be in the same spatial reference. The relations are evaluated in 2D. Z coordinates are not used. Geometry types cannot be mixed within an array.

Version history:

  • Originally added: v1.2
  • errback parameter added: v1.3
  • Return value of dojo.Deferred added: v1.4
  • graphics1,graphics2, spatialRelationship and comparisonString parameters replaced by RelationParameters: v2.0

(As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<RelationParameter> relationParameter Required The set of parameters required to perform the comparison.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onRelationComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution.
Code snippets:
  var relationParams = new esri.tasks.RelationParameters();
  relationParams.geometries1 = geometries[0];
  relationParams.geometries2 = geometries[1];
  relationParams.relation = esri.tasks.RelationParameters.SPATIAL_REL_WITHIN;

  geometryService.relation(relationParams, addRelateResultsToMap);

See also:
onRelationComplete   onError  

reshape(targetGeometry, reshaperGeometry, callback?, errback?)

The reshape operation is performed on a geometry service resource. It reshapes a polyline or a part of a polygon using a reshaping line. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<Geometry[]> targetGeometry Required The polyline or polygon to be reshaped.
<Geometry> reshaperGeometry Required The single-part polyline that does the reshaping.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onReshapeComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution.
Code snippets:
gsvc.reshape(targetGeometry,selectQuery.geometry);

See also:
onReshapeComplete   onError  

simplify(geometries, callback?, errback?)

Alters the given geometries to make their definitions topologically legal with respect to their geometry type. On completion, the onSimplifyComplete event is fired and the optional callback function is invoked. Both the callback and event handlers receive an array of Geometry that contains the simplified geometries.

Version history:

  • Return value of dojo.Deferred added: v1.4
  • graphics paramter replaced by geometries v2.0

Return value: dojo.Deferred
Input Parameters:
<Geometry[]> geometries Required The geometries to simplify
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onSimplifyComplete event.
<Function> errback Optional An error object is returned if an error occurs on the Server during task execution. (As of v1.3)
Code snippets:
gsvc.simplify([ polygonGraphic.geometry ], simplifyCallback);

See also:
onSimplifyComplete   onError  

trimExtend(params, callback?, errback?)

Trims or extends the input polylines using the user specified guide polyline. When trimming features, the portion to the left of the cutting line is preserved in the output and the rest is discarded. If the input polyline is not cut or extended then an empty polyline is added to the output array. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<TrimExtendParameters> params Required Input parameters for the trimExtend operation.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onTrimExtendComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.

union(geometries, callback?, errback?)

The union operation is performed on a geometry service resource. This operation constructs the set-theoretic union of the geometries in the input array. All inputs must be of the same type. (As of v2.0)
Return value: dojo.Deferred
Input Parameters:
<Geometry[]> geometries Required The array of geometries to be unioned.
<Function> callback Optional The function to call when the method has completed. The arguments in the function are the same as the onUnionComplete event.
<Function> errback Optional An error object is returned if an error occurs during task execution.
See also:
onUnionComplete   onError  

Events Detail

onAreasAndLengthsComplete(areasAndLengths)

Fires when the areasAndLengths operation is complete. (As of v1.1)
Arguments:
<Object> areasAndLengths The object with the areas and lengths. The format is { areas : Number[], lengths : Number[] }.
Code snippets:
dojo.connect(geometryService, "onAreasAndLengthsComplete", outputAreaAndLength);

function outputAreaAndLength(result) {
  dojo.byId("area").innerHTML = result.areas[0] + " acres";
  dojo.byId("length").innerHTML = result.lengths[0] + " feet";
}

onAutoCompleteComplete(polygons)

Fires when the autoComplete operation is complete. (As of v2.0)
Arguments:
<Polygon[]> polygons The polygons with the gaps filled with set of polylines.
See also:
autoComplete  

onBufferComplete(geometries)

Fires when the buffer operation is complete.

Version history:

  • Originally added: v1.0
  • graphics return value replaced by geometries: v2.0
Arguments:
<Geometry[]> geometries The geometry representing the buffer.

Prior to version 2.0, the returned argument was

<Graphic[]> graphics The graphics representing the buffer.
Code snippets:
dojo.connect(gsvc, "onBufferComplete", function(geometries) {
  var symbol = new esri.symbol.SimpleFillSymbol("none", new esri.symbol.SimpleLineSymbol("dashdot", new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]));
  var graphic = new esri.Graphic(geometries[0],symbol);
  map.graphics.add(graphic);
});
See also:
buffer  

onConvexHullComplete(geometry)

Fires when the convexHull operation is complete. (As of v2.0)
Arguments:
<Geometry> geometry The geometry defining the convex hull of input geometry.
See also:
convexHull  

onCutComplete(geometries)

Fires when the cut operation is complete. (As of v2.0)
Arguments:
<Geometry[]> geometries The geometry defining the cut region.
See also:
cut  

onDifferenceComplete(geometries)

Fires when the difference operation is complete. (As of v2.0)
Arguments:
<Geometry[]> geometries The geometry defining the difference of input features.
See also:
difference  

onDistanceComplete(distance)

Fires when the distance operation is complete.
Arguments:
<Number> distance The distance between the input geometries.

onError(error)

Fires when an error occurs when executing the task. (As of v1.3)
Arguments:
<Error> error ArcGIS Server error message returned in a JavaScript error object.
See also:
project   simplify   areasAndLengths   lengths   buffer   labelPoints   relation   autoComplete   convexHull   cut   difference   intersect   reshape   union  

onGeneralizeComplete(geometries)

Fires when the generalize operation is complete.
Arguments:
<Geometry[]> geometries The generalized geometries.

onIntersectComplete(geometries)

Fires when the intersect operation is complete. (As of v2.0)
Arguments:
<Geometry[]> geometries The geometry defining the intersection of input features.
See also:
intersect  

onLabelPointsComplete(labelPoints)

Fires when the labelPoints operation is complete.

Version history:

  • Originally added: v1.2
  • The return value of labelPoints changed from Graphic to Geometry: v2.0
Arguments:
<Geometry[]> labelPoints The geometry representing the points calculated inside the polygons.

Prior to version 2.0, the returned argument was

<Graphic[]> labelPoint The graphics representing the points calculated inside the polygons.
See also:
labelPoints  

onLengthsComplete(lengths)

Fires when the lengths operation is complete. (As of v1.1)
Arguments:
<Object> lengths The object with the areas and lengths. The format is { lengths : Number[] }.
Code snippets:
dojo.connect(geometryService, "onLengthsComplete", outputDistance);

function outputDistance(result) {
  dojo.byId("distance").innerHTML = dojo.number.format(result.lengths[0] / 1000) + " kilometers";
}
See also:
lengths  

onOffsetComplete(geometries)

Fires when the offset operation is complete.
Arguments:
<Geometry[]> geometries An array of the offset geometries.

onProjectComplete(geometries)

Fires when the project operation is complete.

Version history:

  • Originally added: v1.0
  • graphics return value replaced by geometries: v2.0
Arguments:
<Geometry[]> geometries The projected geometries.

Prior to version 2.0, the returned argument was

<Graphic[]> graphics The projected graphics.
See also:
project  

onRelationComplete(relationships)

Fires when the relation operation is complete. (As of v1.2)
Arguments:
<Object[]> relationships Indices of the two input geometries that met the specified relationship. The array contains the following properties: geometry1Index, geometry2Index.

Code snippets:
var relationParams = new esri.tasks.RelationParameters();
relationParams.geometries1 = geometries[0];
relationParams.geometries2 = geometries[1];
relationParams.relation = esri.tasks.RelationParameters.SPATIAL_REL_WITHIN;

geometryService.relation(relationParams, function(relations){
  dojo.forEach(relations, function(relation) {
    baseGraphics[relation.geometry1Index].setSymbol(selectSymbol);
  });
});
See also:
relation  

onReshapeComplete(geometry)

Fires when the reshape operation is complete. (As of v2.0)
Arguments:
<Geometry> geometry The geometry defining the reshaped of input feature.
Code snippets:
dojo.connect(gs, "onReshapeComplete", function(reshapedGeometry) {
  var targetGraphic = firePerimeterFL.getSelectedFeatures()[0].setGeometry(reshapedGeometry);
  firePerimeterFL.applyEdits(null, [targetGraphic], null);
});
See also:
reshape  

onSimplifyComplete(geometries)

Fires when the simplify operation is complete.
Arguments:
<Geometry[]> geometries The simpified geometries.
See also:
simplify  

onTrimExtendComplete(geometries)

Fires when the trimExtend operation is complete.
Arguments:
<Geometry[]> geometries An array of the trimmed or extended geometries.
Code snippets:
dojo.connect(gs, "onTrimExtendComplete", function(updatedGeometries) {
  var symbol = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color("red"));
  dojo.forEach(updatedGeometries, function(geometry,i) {
    myMap.graphics.add(new esri.Graphic(geometry, symbol));
  });
});

onUnionComplete(geometry)

Fires when the union operation is complete. (As of v2.0)
Arguments:
<Geometry> geometry The geometry defining the union of input features.
See also:
union