- URL:
- https://<root>/Utilities/Geometry/GeometryServer/relation
- Methods:
GET
- Version Introduced:
- 9.3 SP1
Description
The relation
operation is performed on a geometry service resource. This operation determines the pairs of geometries from the input geometry arrays that participate in the specified spatial relation. Both arrays are assumed to be in the spatial reference specified by sr
, which is a required parameter. Geometry types cannot be mixed within an array. The relations are evaluated in 2D. In other words, z-coordinates are not used. This operation calls simplify
on the input geometries1
and geometries2
.
You can provide arguments to the relation
operation as query parameters defined in the following parameters table.
Request parameters
Parameter | Details |
---|---|
| Specifies the first array of geometries used to compute the relations. 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. All geometries in the Syntax:
Example:
For a large set of geometries, you can specify a URL to the input geometries stored in a JSON structure in a file on a public server. The expected format of the file’s contents will be exactly the same as that expected if the geometries were directly embedded in the request. Syntax
Example
|
| Specifies the second array of geometries to compute the relations. 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. All geometries in the Syntax:
Example:
For a large set of geometries, you can specify a URL to the input geometries stored in a JSON structure in a file on a public server. The expected format of the file’s contents will be exactly the same as that expected if the geometries were directly embedded in the request. Syntax
Example
|
| Specifies 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 Using spatial references. |
| Specifies the spatial relationship to be tested between the two input geometry arrays. Values: |
| The Shape Comparison Language string to be evaluated. Strings such as |
| The response format. The default format is Values: |
Example usage
The following are sample request URLs for relation
. This example determines which of the two input points lies within the input polygon.
https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/relation?sr=4326&geometries1={"geometryType":"esriGeometryPoint","geometries":[{"x":-104.53,"y":34.74},{"x":-63.53,"y":10.23}]}&geometries2={"geometryType":"esriGeometryPolygon","geometries":[{"rings":[[[-105,34],[-104,34],[-104,35],[-105,35],[-105,34]]]}]}&relation=esriGeometryRelationWithin&relationParam=&f=html
This example uses a Shape Comparison Language string (relation
) to determine which polygons have intersecting interiors and boundaries.
https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/relation?sr=4326&geometries1={"geometryType":"esriGeometryPolygon","geometries":[{"rings":[[[0,0],[0,4],[2,2],[3,4],[5,0],[0,0]]]},{"rings":[[[0,4],[3,4],[6.72,3.42],[4.34,2],[0,4]]]}]}&geometries2={"geometryType":"esriGeometryPolygon","geometries":[{"rings":[[[3,4],[6,72,3.42],[4.34,2],[3,4]]]},{"rings":[[[5,1],[7,1],[7,0],[5,0],[5,1]]]},{"rings":[[[1,1],[1,2],[2,1],[1,1]]]},{"rings":[[[3,1],[5,1],[7,1],[7,0],[3,0],[3,1]]]}]}&relation=esriGeometryRelationRelation&relationParam=RELATE(G1,G2,'T***T****')&f=html
JSON Response syntax
{
"relations": [
{
"geometry1Index": <geometry1Index1>,
"geometry2Index": <geometry2Index1>
},
{
"geometry1Index": <geometry1Index2>,
"geometry2Index": <geometry2Index2>
}
]
}
JSON Response example
{
"relations": [
{
"geometry1Index": 0,
"geometry2Index": 3
},
{
"geometry1Index": 1,
"geometry2Index": 0
}
]
}