Union

Description

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.

At 10.1 and later, this operation calls simplify on the input geometries.

You can provide arguments to the union operation as query parameters defined in the following parameters table:

Request parameters

Parameter

Details

f

Description:  (Optional) The response format. The default response format is html.
Values:   html | json

geometries

Description: The array of geometries to be unioned. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.

JSON structures:

Syntax:

{
  "geometryType" : "<esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon>"
  "geometries" : [ <geometry1>, <geometry1>, ..., <geometryN> ]
}

The geometries parameter is an array of input geometries. All geometries in this array should be of the type defined by geometryType.

Example:

{
  "geometryType" : "esriGeometryPolyline",
    "geometries" : 
  [
    {
      "paths" : 
      [
        [[-117,34],[-116,34],[-117,33]],
        [[-115,44],[-114,43],[-115,43]]
      ]
    },
    {
      "paths" : 
      [
        [[32,17],[31,17],[30,17],[30,16]]
      ]
    }
  ]
}

sr

Description: The well-known ID of the spatial reference or a spatial reference JSON object for the input geometries. For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.

Example usage

This example constructs the union of two polygons.

http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/union?sr=102113&geometries={"geometryType":"esriGeometryPolygon","geometries":[{"rings":[[[0,0],[0,1000000],[1000000,-1000000],[0,0]]]},{"rings":[[[0,0],[0,1000000],[1000000,1000000],[0,0]]]}]}&f=html

JSON response syntax

{
  "geometryType" : "<esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon>"
  "geometries" : [ <geometry1>, <geometry1>, ..., <geometryN> ]
}

JSON response example

{
 "geometryType": "esriGeometryPolygon",
 "geometry": {
  "rings": [
   [
    [
     333333.33329999819,
     333333.33329999819
    ],
    [
     1000000,
     -1000000
    ],
    [
     0,
     0
    ],
    [
     0,
     1000000
    ],
    [
     1000000,
     1000000
    ],
    [
     333333.33329999819,
     333333.33329999819
    ]
   ]
  ]
 }
}

9/13/2017