Geometry service Difference method
The Difference method constructs the set-theoretic difference of an array of geometries and a given geometry.
Difference(SpatialReference SpatialReference, Geometry[] InGeometryArray1, Geometry InGeometry2)
Parameter |
Description |
---|---|
SpatialReference |
The SpatialReference 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 of each element of the input array, InGeometryArray1, and InGeometry2. Each resulting geometry is comprised of the portion of the input geometry that is does not intersect InGeometry2. Each result is placed at the corresponding index in the output array - that is, 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 each element in 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, InGeometryArray1, contains all geometries shown except the central circular polygon. The central circular polygon is the parameter InGeometry2. The output array contains the modified geometries that are highlighted in the right part of the figure. Note that one of the output points will be empty because the corresponding input is inside the circular polygon.