Geometry Service Difference method

Constructs the set-theoretic difference between an array of geometries and another geometry.

 

Difference(SpatialReference SpatialReference, Geometry[] InGeometryArray1, Geometry InGeometry2)

 

Parameter

Description

SpatialReference

The spatial reference of the geometries in the InGeometryArray. Cannot be null.

InGeometryArray1

An array of points, multipoints, polylines or polygons. The input types can be mixed.

InGeometry2

A single geometry of any type, of dimension equal to or greater than the elements of InGeometryArray1.

 

Return Value

 

An array of geometries (Geometry[]).

 

Remarks

 

This operation constructs the set-theoretic difference between each element of the input array and InGeometry2.

 

Each result is placed at the corresponding index in the output array &endash; Result[i] = InGeometryArray1[i] Difference InGeometry2.

 

The only restriction on combinations of geometry types is that the dimension of InGeometry2 must be equal to or greater than the dimensions of the elements of InGeometryArray1. Any inputs that are completely within InGeometry2 are represented by empty geometries of the same type in the output array.

 

The figure below shows an example of the difference operation. The geometry array contains all geometries shown with the exception of the central circular polygon. The output array contains the modified geometries shown in the right part of the figure. Note that one of the output points will be ”r;empty” because the corresponding input is inside the circular polygon.

 

 

Above is the difference operation applied to a collection of points, lines.