Intersect

Description

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. The dimension of each resultant geometry is the minimum dimension of the input geometry in the geometries array and the other geometry specified by the geometry parameter.

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

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

Request parameters

Parameter

Details

f

The response format. The default response format is html.
Values:   html | json

geometries

An array of points, multipoints, polylines, or polygons. 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> ]
}

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]]
      ]
    }
  ]
}

geometry

A single geometry of any type with a dimension equal to or greater than the elements of geometries. The structure of geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. The use of simple syntax is not supported.

JSON structures:

Syntax:

{
  "geometryType" : "<esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon>"
  "geometry" : { <geometry1> }
}

Example:

{"geometryType" : "esriGeometryPolygon","geometry" : {
  "rings" : [
   [[-117,34],[-116,34],[-117,33],[-117,34]],
   [[-115,44],[-114,43],[-115,43],[-115,44]]
  ]
 }}

sr

The well-known ID 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

Calculate the intersection of two polygons.

https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/intersect?sr=4269&geometries={"geometryType":"esriGeometryPolygon","geometries":[{"rings":[[[-72,40],[-71,40],[-71,39],[-72,39],[-72,40]]]},{"rings":[[[-74,37],[-74,41],[-73,41],[-73,37],[-74,37]]]}]}&geometry={"geometryType":"esriGeometryPolygon","geometry":{"rings":[[[-75,39],[-74,40],[-73,39],[-72,40],[-71,39],[-71,38],[-75,38],[-75,39]]]}}&f=html

JSON Response syntax

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

JSON Response example

{
 "geometryType": "esriGeometryPolygon",
 "geometries": [
  {
   "rings": [
    [
     [
      -70.999999999999943,
      39.000000000000057
     ],
     [
      -71.999999999999943,
      39.000000000000057
     ],
     [
      -71.999999999999943,
      40.000000000000057
     ],
     [
      -70.999999999999943,
      39.000000000000057
     ]
    ]
   ]
  },
  {
   "rings": [
    [
     [
      -72.999999999999943,
      38.000000000000057
     ],
     [
      -73.999999999999943,
      38.000000000000057
     ],
     [
      -73.999999999999943,
      40.000000000000057
     ],
     [
      -72.999999999999943,
      39.000000000000057
     ],
     [
      -72.999999999999943,
      38.000000000000057
     ]
    ]
   ]
  }
 ]
}