require(["esri/tasks/GeometryService"], function(GeometryService) { /* code goes here */ });
Description
(Added at v1.0)
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.
It is recommended that you create a geometry service for use within your applications. View the
About the geometry service help topic in the Server Resource Center for details. Esri hosts a geometry service at
https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer
. This service can be used for production applications however, we do not guarantee that the service will be available 24/7.
Samples
Search for
samples that use this class.
Constructors
Constants
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 
Properties
url  String  URL to the ArcGIS Server REST resource that represents a locator service. 
Methods
areasAndLengths(areasAndLengthsParameters, callback?, errback?)  Deferred  Computes the area and length for the input polygons. 
autoComplete(polygons, polylines, callback?, errback?)  Deferred  The Auto Complete operation is performed on a geometry service resource. 
buffer(bufferParameters, callback?, errback?)  Deferred  Creates buffer polygons at a specified distance around the given geometries. 
convexHull(geometries, callback?, errback?)  Deferred  The convexHull operation is performed on a geometry service resource. 
cut(geometries, cutterGeometry, callback?, errback?)  Deferred  The cut operation is performed on a geometry service resource. 
densify(densifyParameters, callback?, errback?)  Deferred  The densify operation is performed on a geometry service resource. 
difference(geometries, geometry, callback?, errback?)  Deferred  The difference operation is performed on a geometry service resource. 
distance(params, callback?, errback?)  Deferred  Measures the planar or geodesic distance between geometries. 
fromGeoCoordinateString(params, callback?, errback?)  Deferred  Converts an array of wellknown strings into xycoordinates based on the conversion type and spatial reference supplied by the user. 
generalize(params, callback?, errback?)  Deferred  Generalizes the input geometries using the DouglasPeucker algorithm. 
intersect(geometries, geometry, callback?, errback?)  Deferred  The intersect operation is performed on a geometry service resource. 
labelPoints(polygons, callback?, errback?)  Deferred  Calculates an interior point for each polygon specified. 
lengths(lengthsParameter, callback?, errback?)  Deferred  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
. 
offset(params, callback?, errback?)  Deferred  Constructs the offset of the input geometries based on a planar distance. 
project(params, callback?, errback?)  Deferred  Projects a set of geometries into a new spatial reference. 
relation(relationParameters, callback?, errback?)  Deferred  Computes the set of pairs of geometries from the input geometry arrays that belong to the specified relation. 
reshape(targetGeometry, reshaperGeometry, callback?, errback?)  Deferred  The reshape operation is performed on a geometry service resource. 
simplify(geometries, callback?, errback?)  Deferred  Alters the given geometries to make their definitions topologically legal with respect to their geometry type. 
toGeoCoordinateString(params, callback?, errback?)  Deferred  Converts an array of xycoordinates into wellknown strings based on the conversion type and spatial reference supplied by the user. 
trimExtend(params, callback?, errback?)  Deferred  Trims or extends the input polylines using the user specified guide polyline. 
union(geometries, callback?, errback?)  Deferred  The union operation is performed on a geometry service resource. 
Events
[ On Style Events  Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.
Constructor Details
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 GeometryService, https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer . For more information on constructing a URL, see the ArcGIS Services Directory. 
Property Details
URL to the ArcGIS Server REST resource that represents a locator service. To obtain the URL, use
Services Directory.
Method Details
Computes the area and length for the input
polygons.
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) 
Sample: require([
"esri/tasks/AreasAndLengthsParameters", "esri/tasks/GeometryService", ...
], function(AreasAndLengthsParameters, GeometryService, ... ) {
var geometryService = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
var areasAndLengthParams = new AreasAndLengthsParameters();
areasAndLengthParams.lengthUnit = GeometryService.UNIT_FOOT;
areasAndLengthParams.areaUnit = GeometryService.UNIT_ACRES;
geometryService.simplify([geometry], function(simplifiedGeometries) {
areasAndLengthParams.polygons = simplifiedGeometries;
geometryService.areasAndLengths(areasAndLengthParams, function(measurements){
// do something with the results here
});
});
...
});
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. (Added at v2.0)
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. 
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.
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 buffercomplete event. 
<Function > errback 
Optional 
An error object is returned if an error occurs on the Server during task execution. (As of v1.3) 
Sample: require([
"esri/tasks/BufferParameters", "esri/SpatialReference", "dojo/dom",
"esri/tasks/GeometryService", ...
], function(BufferParameters, SpatialReference, dom, GeometryService, ... ) {
var params = new BufferParameters();
params.geometries = [ evt.mapPoint ];
params.distances = [ dom.byId('bufferDistance').value ];
params.unit = GeometryService.UNIT_KILOMETER;
params.bufferSpatialReference = new SpatialReference({wkid: 32662});
params.outSpatialReference = map.spatialReference;
gsvc.buffer(params);
...
});
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. (Added at v2.0)
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. 
The cut operation is performed on a geometry service resource. This operation splits the input polyline or polygon where it crosses a cutting polyline. (Added at v2.0)
Parameters:
<Geometry[] > geometries 
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. 
The densify operation is performed on a geometry service resource. This operation densifies geometries by plotting points between existing vertices.
See also
(Added at v2.0) Parameters:
<DensifyParameters > densifyParameters 
Required 
The DensifyParameters objects contains geometries, geodesic, lengthUnit, and maxSegmentLength parameters. 
<Function > callback 
Optional 
The function to call when the method has completed. The arguments in the function are the same as the densifycomplete event. 
<Function > errback 
Optional 
An error object is returned if an error occurs on the Server during task execution. (As of v1.3) 
Sample: require([
"esri/tasks/DensifyParameters", "esri/tasks/GeometryService", ...
], function(DensifyParameters, GeometryService, ... ) {
var geometryService = new GeometryService( ... );
geometryService.on("densifycomplete", densifyCompleteHandler);
var geometries = [];
geometries.push(geometry);
var densifyParameters = new DensifyParameters();
densifyParameters.geometries = geometries;
densifyParameters.maxSegmentLength = 10;
geometryService.densify(densifyParameters);
});
The difference operation is performed on a geometry service resource. This operation constructs the settheoretic difference between an array of geometries and another geometry. (Added at v2.0)
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. 
Measures the planar or geodesic distance between geometries. (Added at v2.0)
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. 
Sample: require([
"esri/tasks/GeometryService", "esri/tasks/DistanceParameters", "dojo/dom", ...
], function(GeometryService, DistanceParameters, dom, ... ) {
var geometryService = new GeometryService( ... );
var distParams = new DistanceParameters();
distParams.distanceUnit = GeometryService.UNIT_STATUTE_MILE;
distParams.geometry1 = inputPoints[inputPoints.length  2];
distParams.geometry2 = inputPoints[inputPoints.length  1];
distParams.geodesic = true;
geometryService.distance(distParams, function(distance) {
dom.byId('distanceDetails').innerHTML = distance;
});
...
});
Converts an array of wellknown strings into xycoordinates based on the conversion type and spatial reference supplied by the user. Only available with ArcGIS Server 10.3 or above. (Added at v3.12)
Parameters:
<Object > params 
Required 
See the object specifications table below for the structure of the params object. 
<Function > callback 
Optional 
The function to call when the method has completed. 
<Function > errback 
Optional 
An error object is returned if an error occurs during task execution. 
Object Specifications: <params
>
<String > conversionMode 
Required 
Conversion options for MGRS, UTM and GARS conversion types. This parameter is optional. See the ArcGIS REST API documentation for valid values and their descriptions. 
<String > conversionType 
Required 
The conversion type of the input strings. The default value is MRGS .
Possible Values: MRGS  USNG  UTM  GeoRef  GARS  DMS  DDM  DD 
<SpatialReference > sr 
Required 
The spatial reference or wellknown ID to convert the input string coordinates to. 
<String[] > strings 
Required 
An array of formatted strings as specified by conversionType .
Example: ["01N AA 66021 00000", "11S NT 00000 62155", "31U BT 94071 65288"] 
Generalizes the input geometries using the DouglasPeucker algorithm. (Added at v2.0)
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. 
The intersect operation is performed on a geometry service resource. This operation constructs the settheoretic intersection between an array of geometries and another geometry. (Added at v2.0)
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. 
Calculates an interior point for each polygon specified. These interior points can be used by clients for labeling the polygons. (Added at v1.2)
Parameters:
<Polygon[] > 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) 
Sample: require([
"esri/symbols/Font", "esri/symbols/TextSymbol", "esri/Color", "esri/Graphic", "dojo/_base/array", "dojo/number", ...
], function(Font, TextSymbol, Color, Graphic, array, number, ... ) {
geometryService.labelPoints(geometries, function(labelPoints) {
var font = new Font("20px", Font.STYLE_NORMAL, Font.VARIANT_NORMAL, Font.WEIGHT_BOLDER);
array.forEach(labelPoints, function(labelPoint) {
var textSymbol = new TextSymbol(
"X: " + number.format(labelPoint.x) + ", Y: " + number.format(labelPoint.y),
font, new Color([0, 0, 0])
);
var labelPointGraphic = new Graphic(labelPoint,textSymbol);
map.graphics.add(labelPointGraphic);
});
});
...
});
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
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) 
Sample: require([
"esri/tasks/LengthsParameters", "esri/tasks/GeometryService", ...
], function(LengthsParameters, GeometryService, ... ) {
var lengthParams = new LengthsParameters();
var geometryService = new GeometryService( ... );
lengthParams.polylines = [geometry];
lengthParams.lengthUnit = GeometryService.UNIT_METER;
lengthParams.geodesic = true;
geometryService.lengths(lengthParams);
...
});
Constructs the offset of the input geometries based on a planar distance. 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.
(Added at v2.0) 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. 
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 that contains the projected geometries. (Added at v3.0)
Parameters:
<ProjectParameters > params 
Required 
The input projection parameters. 
<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) 
Sample: require([
"esri/tasks/ProjectParameters", ...
], function(ProjectParameters, ... ) {
var params = new ProjectParameters();
params.geometries = [point];
params.outSR = outSR;
params.transformation = transformation;
gsvc.project(params);
...
});
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. (Added at v2.0)
Parameters:
<RelationParameters > relationParameters 
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. 
Sample: require([
"esri/tasks/GeometryService", "esri/tasks/RelationParameters", ...
], function(GeometryService, RelationParameters, ... ) {
var geometryService = new GeometryService( ... );
var relationParams = new RelationParameters();
relationParams.geometries1 = geometries[0];
relationParams.geometries2 = geometries[1];
relationParams.relation = RelationParameters.SPATIAL_REL_WITHIN;
geometryService.relation(relationParams, addRelateResultsToMap);
...
});
The reshape operation is performed on a geometry service resource. It reshapes a polyline or a part of a polygon using a reshaping line. (Added at v2.0)
Parameters:
<Geometry > targetGeometry 
Required 
The polyline or polygon to be reshaped. 
<Geometry > reshaperGeometry 
Required 
The singlepart 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. 
Sample:
gsvc.reshape(targetGeometry,selectQuery.geometry);
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.
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) 
Sample: gsvc.simplify([ polygonGraphic.geometry ], simplifyCallback);
Converts an array of xycoordinates into wellknown strings based on the conversion type and spatial reference supplied by the user. Only available with ArcGIS Server 10.3 or above. (Added at v3.12)
Parameters:
<Object > params 
Required 
See the object specifications table below for the structure of the params object. 
<Function > callback 
Optional 
The function to call when the method has completed. 
<Function > errback 
Optional 
An error object is returned if an error occurs during task execution. 
Object Specifications: <params
>
<Boolean > addSpaces 
Required 
If true , then spaces are added between components of the string. The addSpaces parameter applies only to conversion types MGRS, USNG and UTM. The default value for MGRS is false , while the default value for both USNG and UTM is true . This parameter is optional. 
<String > conversionMode 
Required 
Conversion options for MGRS, UTM and GARS conversion types. This parameter is optional. See the ArcGIS REST API documentation for valid values and their descriptions. This parameter is optional. 
<String > conversionType 
Required 
The conversion type of the input strings. The default value is MRGS .
Possible Values: MRGS  USNG  UTM  GeoRef  GARS  DMS  DDM  DD 
<Number[][] > coordinates 
Required 
An array of XYcoordinates (in JSON format) to be converted. 
<Number > numOfDigits 
Required 
The number of digits to output for each of the numerical portions in the string. The default value depends on conversionType . See the ArcGIS REST API documentation for default values. This parameter is optional. 
<Boolean > rounding 
Required 
If true , then numeric portions of the string are rounded to the nearest whole magnitude as specified by numOfDigits . Otherwise, numeric portions of the string are truncated. The rounding parameter applies only to conversion types MGRS, USNG and GeoRef. The default value is true . This parameter is optional. 
<SpatialReference > sr 
Required 
The spatial reference (or WKID of the spatial reference) of the XYcoordinates to be converted. 
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. (Added at v2.0)
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. 
The union operation is performed on a geometry service resource. This operation constructs the settheoretic union of the geometries in the input array. All inputs must be of the same type. (Added at v2.0)
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. 
Event Details
[ On Style Events  Connect Style Event ]
Fires when the areasAndLengths operation is complete. Should be used in favor of onAreasAndLengthsComplete. (Added at v3.5)
Event Object Properties:
<Object > result 
The object with the areas and lengths. The format is { areas : Number[], lengths : Number[] }. 
Sample: geometryService.on("areasandlengthscomplete", outputAreaAndLength);
function outputAreaAndLength(evt) {
dojo.byId("area").innerHTML = evt.result.areas[0] + " acres";
dojo.byId("length").innerHTML = evt.result.lengths[0] + " feet";
}
Fires when the autoComplete operation is complete. Should be used in favor of onAutoCompleteComplete. (Added at v3.5)
Event Object Properties:
<Polygon[] > geometries 
The polygons with the gaps filled with set of polylines. 
Fires when the buffer operation is complete. (Added at v3.5)
Event Object Properties:
<Polygon[] > geometries 
The polygon geometries representing the buffer. 
Sample: require([
"esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol",
"esri/Color", "esri/graphic", ...
], function( SimpleFillSymbol, SimpleLineSymbol, Color, Graphic, ... ) {
gsvc.on("buffercomplete", function(evt) {
var symbol = new SimpleFillSymbol("none", new SimpleLineSymbol("dashdot", new Color([255,0,0]), 2), new Color([255,255,0,0.25]));
var graphic = new Graphic(evt.geometries[0],symbol);
map.graphics.add(graphic);
});
...
});
Fires when the convexHull operation is complete. Should be used in favor of onConvexHullComplete. (Added at v3.5)
Event Object Properties:
<Geometry > geometry 
The geometry defining the convex hull of input geometry. 
Fires when the cut operation is complete. Should be used in favor of onCutComplete. (Added at v3.5)
Event Object Properties:
<Object > result 
An object that contains an array of cutIndexes and an array of geometries.
result: {
cutIndexes Number[]
geometries Geometry[]
}

Fires when the densify operation is complete. (Added at v3.5)
Event Object Properties:
<Geometry[] > geometries 
The geometry defining the densified input features. 
Sample: require([
"esri/tasks/GeometryService", ...
], function(GeometryService, ... ) {
var geometryService = new GeometryService( ... );
geometryService.on("densifycomplete", densifyCompleteHandler);
function densifyCompleteHandler(event){
if (event) {
var geometriesArray = event["geometries"];
var geometry = geometriesArray[0];
console.log("geometry detail", geometry.paths[0].length);
}
}
});
Fires when the difference operation is complete. Should be used in favor of onDifferenceComplete. (Added at v3.5)
Event Object Properties:
<Geometry[] > geometries 
The geometry defining the difference of input features. 
Fires when the distance operation is complete. Should be used in favor of onDistanceComplete. (Added at v3.5)
Event Object Properties:
<Number > distance 
The distance between the input geometries. 
Fires when an error occurs when executing the task. Should be used in favor of onError. (Added at v3.5)
See also: areasAndLengths(),
autoComplete(),
buffer(),
convexHull(),
cut(),
densify(),
difference(),
intersect(),
labelPoints(),
lengths(),
project(),
relation(),
reshape(),
simplify(),
union()
Fires when the generalize operation is complete. Should be used in favor of onGeneralizeComplete. (Added at v3.5)
Event Object Properties:
<Geometry[] > geometries 
The generalized geometries. 
Fires when the intersect operation is complete. Should be used in favor of onIntersectComplete. (Added at v3.5)
Event Object Properties:
<Geometry[] > geometries 
The geometry defining the intersection of input features. 
Fires when the labelPoints operation is complete. Should be used in favor of onLabelPointsComplete. (Added at v3.5)
Event Object Properties:
<Point[] > geometries 
An array of points representing the interior points of the input polygons that may be used for labeling. 
Fires when the lengths operation is complete. Should be used in favor of onLengthsComplete. (Added at v3.5)
Event Object Properties:
<Object > result 
The object with the lengths.
result: {
lengths : Number[]
}

Fires when the offset operation is complete. Should be used in favor of onOffsetComplete. (Added at v3.5)
Event Object Properties:
<Geometry[] > geometries 
An array of the offset geometries. 
Fires when the project operation is complete. (Added at v3.6)
Fires when the relation operation is complete. Should be used in favor of onRelationComplete. (Added at v3.5)
Fires when the reshape operation is complete. Should be used in favor of onReshapeComplete. (Added at v3.5)
Event Object Properties:
<Geometry > geometry 
The geometry defining the reshaped of input feature. 
Fires when the simplify operation is complete. Should be used in favor of onSimplifyComplete. (Added at v3.5)
Event Object Properties:
<Geometry[] > geometries 
The simplified geometries. 
Fires when the trimExtend operation is complete. Should be used in favor of onTrimExtendComplete. (Added at v3.5)
Event Object Properties:
<Geometry[] > geometries 
An array of the trimmed or extended geometries. 
Fires when the union operation is complete. Should be used in favor of onUnionComplete. (Added at v3.5)
Event Object Properties:
<Geometry > geometry 
The geometry defining the union of input features. 
Fires when the areasAndLengths operation is complete. (Added at v1.1)
Event Object Properties:
<Object > areasAndLengths 
The object with the areas and lengths. The format is { areas : Number[], lengths : Number[] }. 
Sample:
dojo.connect(geometryService, "onAreasAndLengthsComplete", outputAreaAndLength);
function outputAreaAndLength(result) {
dojo.byId("area").innerHTML = result.areas[0] + " acres";
dojo.byId("length").innerHTML = result.lengths[0] + " feet";
}
Fires when the autoComplete operation is complete. (Added at v2.0)
Event Object Properties:
<Polygon[] > polygons 
The polygons with the gaps filled with set of polylines. 
Fires when the buffer operation is complete.
Event Object Properties:
<Geometry[] > geometries 
The geometry representing the buffer. 
Sample: dojo.connect(gsvc, "onBufferComplete", function(geometries) {
var symbol = new esri.symbol.SimpleFillSymbol("none", new esri.symbol.SimpleLineSymbol("dashdot", new esri.Color([255,0,0]), 2), new esri.Color([255,255,0,0.25]));
var graphic = new esri.Graphic(geometries[0],symbol);
map.graphics.add(graphic);
});
Fires when the convexHull operation is complete. (Added at v2.0)
Event Object Properties:
<Geometry > geometry 
The geometry defining the convex hull of input geometry. 
Fires when the cut operation is complete. (Added at v2.0)
Event Object Properties:
<Object > results 
An object that contains an array of cutIndexes and an array of geometries. 
Sample: dojo.connect(geomService, "onCutComplete", function(results) {
dojo.forEach(results.geometries,function(geometry){
map.graphics.add(new esri.Graphic(geometry,new esri.symbol.SimpleFillSymbol()));
});
});
Fires when the difference operation is complete. (Added at v2.0)
Event Object Properties:
<Geometry[] > geometries 
The geometry defining the difference of input features. 
Fires when the distance operation is complete.
Event Object Properties:
<Number > distance 
The distance between the input geometries. 
Fires when an error occurs when executing the task. (Added at v1.3)
Fires when the generalize operation is complete.
Event Object Properties:
<Geometry[] > geometries 
The generalized geometries. 
Fires when the intersect operation is complete. (Added at v2.0)
Event Object Properties:
<Geometry[] > geometries 
The geometry defining the intersection of input features. 
Fires when the labelPoints operation is complete.
Event Object Properties:
<Geometry[] > labelPoints 
The geometry representing the points calculated inside the polygons. 
Fires when the lengths operation is complete. (Added at v1.1)
Event Object Properties:
<Object > lengths 
The object with the areas and lengths. The format is { lengths : Number[] }. 
Sample:
dojo.connect(geometryService, "onLengthsComplete", outputDistance);
function outputDistance(result) {
dojo.byId("distance").innerHTML = dojo.number.format(result.lengths[0] / 1000) + " kilometers";
}
Fires when the offset operation is complete.
Event Object Properties:
<Geometry[] > geometries 
An array of the offset geometries. 
Fires when the project operation is complete.
Fires when the relation operation is complete. (Added at v1.2)
Event Object Properties:
<Object[] > relationships 
Indices of the two input geometries that met the specified relationship. The array contains the following properties: geometry1Index, geometry2Index.

Sample:
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);
});
});
Fires when the reshape operation is complete. (Added at v2.0)
Event Object Properties:
<Geometry > geometry 
The geometry defining the reshaped of input feature. 
Sample:
dojo.connect(gs, "onReshapeComplete", function(reshapedGeometry) {
var targetGraphic = firePerimeterFL.getSelectedFeatures()[0].setGeometry(reshapedGeometry);
firePerimeterFL.applyEdits(null, [targetGraphic], null);
});
Fires when the simplify operation is complete.
Event Object Properties:
<Geometry[] > geometries 
The simplified geometries. 
Fires when the trimExtend operation is complete.
Event Object Properties:
<Geometry[] > geometries 
An array of the trimmed or extended geometries. 
Sample:
dojo.connect(gs, "onTrimExtendComplete", function(updatedGeometries) {
var symbol = new esri.symbol.SimpleLineSymbol().setColor(new esri.Color("red"));
dojo.forEach(updatedGeometries, function(geometry,i) {
myMap.graphics.add(new esri.Graphic(geometry, symbol));
});
});
Fires when the union operation is complete. (Added at v2.0)
Event Object Properties:
<Geometry > geometry 
The geometry defining the union of input features. 