Skip To Content

Group By Proximity

Description

The GroupByProximity tool groups features that are within spatial or spatiotemporal proximity of each other.

The following are examples:

  • Which roads are connected?
  • Where do I have gaps in my data?
  • Which GPS points are within 1 mile of each other within 10 minutes?
Note:

Sliver features may be excluded based on the tolerance of the processing spatial reference.

The output result is a copy of the input with a new field named group_id. The group_id field represents the grouping of features. Features with the same group_id value are in the same group. The group numbers represent membership in a particular group and don't imply value. The group numbers may not be sequential or the same number in repeat use of the tool.

Request parameters

ParameterDescription
inputLayer

(Required)

The point, line, or polygon features that will be grouped.

Syntax: As described in Feature input, this parameter can be one of the following:

  • A URL to a feature service layer with an optional filter to select specific features
  • A URL to a big data catalog service layer with an optional filter to select specific features
  • A feature collection

REST examples

//REST web example
inputLayer={"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0", "filter": "Month = 'September'"}

//REST scripting example
"inputLayer": {"url": "https://myportal.domain.com/server/rest/services/Hosted/hurricaneTrack/FeatureServer/0", "filter": "Month = 'September'"}
spatialRelationship

(Required)

The type of relationship to group by. For more information on the values for this parameter, see the Spatial relationships section below.

Values: Intersects | Touches | NearGeodesic | NearPlanar

REST examples

//REST web example
spatialRelationship=Intersect

//REST scripting example
"spatialRelationship": "Touches"
spatialNearDistance

(Required if spatialRelationship is NearGeodesic or NearPlanar

A double value used for the search distance to determine if features are near one another. This is only applied if NearGeodesic or NearPlanar is the selected spatialRelationship. You can enter a single distance value. The units of the distance values are supplied by the spatialNearDistanceUnit parameter.

Analysis using a Near spatial relationship requires that the targetLayer or processing extent (processSR) have a projected coordinate system.

REST examples

//REST web example
spatialNearDistance=4

//REST scripting example
"spatialNearDistance": 4
spatialNearDistanceUnit

(Required if spatialRelationship is NearPlanar or NearGeodesic)

The linear unit to be used with the distance value specified in spatialNearDistance. The default value is Meters.

Values: Meters | Kilometers | Feet | FeetInt | FeetUS | Miles | MilesInt | MilesUS | NauticalMiles | NauticalMilesInt | NauticalMilesUS | Yards | YardsInt | YardsUS

REST examples

//REST web example
spatialNearDistanceUnit=Miles

//REST scripting example
"spatialNearDistanceUnit": "Miles"
temporalRelationship

(Optional)

The type of temporal relationship to group by. For more information on the values for this parameter, see the Temporal relationships section below.

Values: Intersects | Near

REST examples

//REST web example
temporalRelationship=Intersect

//REST scripting example
"temporalRelationship": "Erase"
temporalNearDistance

(Required if temporalRelationship is Near

A double value used for the temporal search distance to determine if features are near one another. This is only applied if Near is the selected temporalRelationship parameter. You can enter a single distance value. The units of the distance values are supplied by the temporalNearDistanceUnit parameter.

REST examples

//REST web example
temporalNearDistance=4

//REST scripting example
"temporalNearDistance": 4
temporalNearDistanceUnit

(Required if temporalRelationship is Near)

The temporal unit to be used with the distance value specified in temporalNearDistance.

Values: Milliseconds | Seconds | Minutes | Hours | Days | Weeks| Months | Years

REST examples

//REST web example
temporalNearDistanceUnit=Miles

//REST scripting example
"temporalNearDistanceUnit": "Hours"
attributeRelationship

(Optional)

Introduced at ArcGIS Enterprise 11.0. An attribute relationship to group features by. The attribute expression is a symmetric operation. The tool takes an input layer that's compared against itself to find groups. Because of this, the input layer is denoted as both a and b, and all expressions should include both a and b.

REST examples

//REST web example
"$a['REGION'] == $b['REGION']

//REST scripting example
"attributeRelationship": "Abs($a['ACCURACY'] - $b['ACCURACY']) < 2"
outputName

(Required)

The task will create a feature service of the results. You define the name of the service.

REST examples

//REST web example
outputName=myOutput

//REST scripting example
"outputName": "myOutput"
context

(Optional)

The context parameter contains additional settings that affect task execution. For this task, there are four settings:

  • Extent (extent)—A bounding box that defines the analysis area. Only those features that intersect the bounding box will be analyzed.
  • Processing spatial reference (processSR)—The features will be projected into this coordinate system for analysis.
  • Output spatial reference (outSR)—The features will be projected into this coordinate system after the analysis to be saved. The output spatial reference for the spatiotemporal big data store is always WGS84.
  • Data store (dataStore)—Results will be saved to the specified data store. The default is the spatiotemporal big data store.

Syntax:
{
"extent" : {extent},
"processSR" : {spatial reference},
"outSR" : {spatial reference},
"dataStore":{data store}
}

f

The response format. The default response format is html.

Values: html | json

Spatial relationships

The tables below describe the overlay relationships supported by the spatialRelationship parameter.

Spatial RelationshipDescription
Intersects

Computes a geometric intersection of the input layers. Features or portions of features that overlap are grouped. This is the default. Intersects supports the following geometries as inputs:

  • Points
  • Lines
  • Polygons
Touches

A feature touches another feature if they have an intersecting vertex, but the features do not overlap. Touches supports the following geometries as inputs:

  • Line
  • Polygon
NearPlanar

Conceptually, these operators buffer the features using the specified distance and return all the features that intersect the join features with the buffer applied. The distance calculation uses a planar distance. NearPlanar supports the following geometries as inputs:

  • Points
  • Lines
  • Polygons
NearGeodesic

Conceptually, these operators buffer the features using the specified distance and return all the features that intersect the join features with the buffer applied. The distance calculation uses a geodesic distance. NearGeodesic supports the following geometries as inputs:

  • Points
  • Lines
  • Polygons

Temporal relationships

The table below describes the temporal relationships supported by the temporalRelationship parameter.

Temporal relationshipDescription
Intersects

When any part of a feature's time overlaps another. Intersects supports the following time types as inputs:

  • Instants
  • Intervals
Near

A feature is near another if the time is within a given temporal distance of the other feature.

  • Instants
  • Intervals

Example usage

The following is a sample request URL for GroupByProximity:

https://machine.domain.com/webadaptor/rest/services/System/GeoAnalyticsTools/GPServer/GroupByProximity/submitJob?&inputLayer={"url":"https://webadaptor.domain.com/server/rest/services/Hurricane/hurricaneTrack/0"}&spatialRelationship=Intersects&outputName=myOutput&context={"extent":{"xmin":-122.68,"ymin":45.53,"xmax":-122.45,"ymax":45.6,"spatialReference":{"wkid":4326}}}&f=json

Response

When you submit a request, the service assigns a unique job ID for the transaction.

Syntax:
{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}

After the initial request is submitted, you can use jobId to periodically check the status of the job and messages as described in Check job status. Once the job has successfully completed, use jobId to retrieve the results. To track the status, you can make a request of the following form:

https://<analysis url>/GroupByProximity/jobs/<jobId>

Access results

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

https://<analysis-url>/GroupByProximity/jobs/<jobId>/results/output?token=<your token>&f=json

ResponseDescription
output

The features that are the result of the grouping with a new field called group_id that represents the grouping of features. The type of feature (point, line, or polygon) depends on the input layers.

{"url": "https://<analysis-url>/GroupByProximity/jobs/<jobId>/results/output"}

The result has properties for parameter name, data type, and value. The contents of value depend on the outputName parameter provided in the initial request. The value contains the URL of the feature service layer.

{
"paramName":"output", 
"dataType":"GPRecordSet",
"value":{"url":"<hosted featureservice layer url>"}
}

See Feature output for more information about how the result layer is accessed.