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

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

NameSummary
new GeometryService(url)Creates a new GeometryService object.

Constants

NameDescription
UNIT_ACRESAcres (areal unit)
UNIT_ARESAres (areal unit)
UNIT_FOOTInternational foot (0.3048 meters)
UNIT_HECTARESHectares (areal unit)
UNIT_KILOMETERKilometer
UNIT_METERInternational meters
UNIT_NAUTICAL_MILENautical Miles (1,852 meters)
UNIT_SQUARE_CENTIMETERSSquare Centimeters (areal unit)
UNIT_SQUARE_DECIMETERSSquare Decimeters (areal unit)
UNIT_SQUARE_FEETSquare Feet (areal unit)
UNIT_SQUARE_INCHESSquare Inches (areal unit)
UNIT_SQUARE_KILOMETERSSquare Kilometers (areal unit)
UNIT_SQUARE_METERSSquare Meters (areal unit)
UNIT_SQUARE_MILESSquare Miles (areal unit)
UNIT_SQUARE_MILLIMETERSSquare Millimeters (areal unit)
UNIT_SQUARE_YARDSSquare Yards (areal unit)
UNIT_STATUTE_MILEMiles (5,280 feet, 1,760 yards, or exactly 1,609.344 meters)
UNIT_US_NAUTICAL_MILEUS Nautical Mile

Properties

NameTypeSummary
urlStringURL to the ArcGIS Server REST resource that represents a locator service.

Methods

NameReturn typeSummary
areasAndLengths(areasAndLengthsParameters, callback?, errback?)DeferredComputes the area and length for the input polygons.
autoComplete(polygons, polylines, callback?, errback?)DeferredThe Auto Complete operation is performed on a geometry service resource.
buffer(bufferParameters, callback?, errback?)DeferredCreates buffer polygons at a specified distance around the given geometries.
convexHull(geometries, callback?, errback?)DeferredThe convexHull operation is performed on a geometry service resource.
cut(geometries, cutterGeometry, callback?, errback?)DeferredThe cut operation is performed on a geometry service resource.
densify(densifyParameters, callback?, errback?)DeferredThe densify operation is performed on a geometry service resource.
difference(geometries, geometry, callback?, errback?)DeferredThe difference operation is performed on a geometry service resource.
distance(params, callback?, errback?)DeferredMeasures the planar or geodesic distance between geometries.
fromGeoCoordinateString(params, callback?, errback?)DeferredConverts an array of well-known strings into xy-coordinates based on the conversion type and spatial reference supplied by the user.
generalize(params, callback?, errback?)DeferredGeneralizes the input geometries using the Douglas-Peucker algorithm.
intersect(geometries, geometry, callback?, errback?)DeferredThe intersect operation is performed on a geometry service resource.
labelPoints(polygons, callback?, errback?)DeferredCalculates an interior point for each polygon specified.
lengths(lengthsParameter, callback?, errback?)DeferredGets 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?)DeferredConstructs the offset of the input geometries based on a planar distance.
project(params, callback?, errback?)DeferredProjects a set of geometries into a new spatial reference.
relation(relationParameters, callback?, errback?)DeferredComputes the set of pairs of geometries from the input geometry arrays that belong to the specified relation.
reshape(targetGeometry, reshaperGeometry, callback?, errback?)DeferredThe reshape operation is performed on a geometry service resource.
simplify(geometries, callback?, errback?)DeferredAlters the given geometries to make their definitions topologically legal with respect to their geometry type.
toGeoCoordinateString(params, callback?, errback?)DeferredConverts an array of xy-coordinates into well-known strings based on the conversion type and spatial reference supplied by the user.
trimExtend(params, callback?, errback?)DeferredTrims or extends the input polylines using the user specified guide polyline.
union(geometries, callback?, errback?)DeferredThe 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.

Events

NameEvent ObjectSummary
areas-and-lengths-complete
{
  result: <Object>
}
Fires when the areasAndLengths operation is complete.
auto-complete-complete
{
  geometries: <Polygon[]>
}
Fires when the autoComplete operation is complete.
buffer-complete
{
  geometries: <Polygon[]>
}
Fires when the buffer operation is complete.
convex-hull-complete
{
  geometry: <Geometry>
}
Fires when the convexHull operation is complete.
cut-complete
{
  result: <Object>
}
Fires when the cut operation is complete.
densify-complete
{
  geometries: <Geometry[]>
}
Fires when the densify operation is complete.
difference-complete
{
  geometries: <Geometry[]>
}
Fires when the difference operation is complete.
distance-complete
{
  distance: <Number>
}
Fires when the distance operation is complete.
errorFires when an error occurs when executing the task.
generalize-complete
{
  geometries: <Geometry[]>
}
Fires when the generalize operation is complete.
intersect-complete
{
  geometries: <Geometry[]>
}
Fires when the intersect operation is complete.
label-points-complete
{
  geometries: <Point[]>
}
Fires when the labelPoints operation is complete.
lengths-complete
{
  result: <Object>
}
Fires when the lengths operation is complete.
offset-complete
{
  geometries: <Geometry[]>
}
Fires when the offset operation is complete.
project-complete
{
  geometries: <Geometry[]>
}
Fires when the project operation is complete.
relation-completeFires when the relation operation is complete.
reshape-complete
{
  geometry: <Geometry>
}
Fires when the reshape operation is complete.
simplify-complete
{
  geometries: <Geometry[]>
}
Fires when the simplify operation is complete.
trim-extend-complete
{
  geometries: <Geometry[]>
}
Fires when the trimExtend operation is complete.
union-complete
{
  geometry: <Geometry>
}
Fires when the union operation is complete.
Constructor Details

new 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 GeometryService, https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer. For more information on constructing a URL, see the ArcGIS Services Directory.
Property Details

<String> url

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

areasAndLengths(areasAndLengthsParameters, callback?, errback?)

Computes the area and length for the input polygons.
Return type: Deferred
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
    });
  });
  ...
});

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. (Added at v2.0)
Return type: Deferred
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.

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 type: Deferred
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 buffer-complete 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);
  ...
});

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. (Added at v2.0)
Return type: Deferred
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.

cut(geometries, 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. (Added at v2.0)
Return type: Deferred
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.

densify(densifyParameters, callback?, errback?)

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)
Return type: Deferred
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 densify-complete 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("densify-complete", densifyCompleteHandler);
  var geometries = [];
  geometries.push(geometry);

  var densifyParameters = new DensifyParameters();
  densifyParameters.geometries = geometries;
  densifyParameters.maxSegmentLength = 10;
  geometryService.densify(densifyParameters);
});

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. (Added at v2.0)
Return type: Deferred
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.

distance(params, callback?, errback?)

Measures the planar or geodesic distance between geometries. (Added at v2.0)
Return type: Deferred
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;
  });
  ...
});

fromGeoCoordinateString(params, callback?, errback?)

Converts an array of well-known strings into xy-coordinates 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)
Return type: Deferred
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 well-known 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"]

generalize(params, callback?, errback?)

Generalizes the input geometries using the Douglas-Peucker algorithm. (Added at v2.0)
Return type: Deferred
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. (Added at v2.0)
Return type: Deferred
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.

labelPoints(polygons, callback?, errback?)

Calculates an interior point for each polygon specified. These interior points can be used by clients for labeling the polygons. (Added at v1.2)
Return type: Deferred
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);
    });
  });
  ...
});

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

offset(params, callback?, errback?)

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)
Return type: Deferred
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(params, 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 that contains the projected geometries. (Added at v3.0)
Return type: Deferred
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);
  ...
});

relation(relationParameters, 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. (Added at v2.0)
Return type: Deferred
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);
  ...
});

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. (Added at v2.0)
Return type: Deferred
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.
Sample:

gsvc.reshape(targetGeometry,selectQuery.geometry);

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.
Return type: Deferred
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);

toGeoCoordinateString(params, callback?, errback?)

Converts an array of xy-coordinates into well-known 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)
Return type: Deferred
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 XY-coordinates (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 XY-coordinates to be converted.

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. (Added at v2.0)
Return type: Deferred
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. (Added at v2.0)
Return type: Deferred
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 ]

areas-and-lengths-complete

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("areas-and-lengths-complete", outputAreaAndLength);

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

auto-complete-complete

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.
See also: autoComplete()

buffer-complete

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("buffer-complete", 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);
  });
  ...
});
See also: buffer()

convex-hull-complete

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.
See also: convexHull()

cut-complete

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[]
  }
See also: cut()

densify-complete

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("densify-complete", densifyCompleteHandler);
  
  function densifyCompleteHandler(event){
    if (event) {
      var geometriesArray = event["geometries"];
      var geometry = geometriesArray[0];
      console.log("geometry detail", geometry.paths[0].length);
    }
  }
});
See also: densify()

difference-complete

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.
See also: difference()

distance-complete

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.

error

Fires when an error occurs when executing the task. Should be used in favor of onError. (Added at v3.5)

generalize-complete

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.

intersect-complete

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.
See also: intersect()

label-points-complete

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.

lengths-complete

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[]
  }
See also: lengths()

offset-complete

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.

project-complete

Fires when the project operation is complete. (Added at v3.6)
Event Object Properties:
<Geometry[]> geometries The projected geometries.
See also: project()

relation-complete

Fires when the relation operation is complete. Should be used in favor of onRelationComplete. (Added at v3.5)
See also: relation()

reshape-complete

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.
See also: reshape()

simplify-complete

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.
See also: simplify()

trim-extend-complete

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.

union-complete

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.
See also: union()
Show Modal