How to perform geometry analysis

1. Select an operation

The first step to performing a geometry analysis is to select an operation. Operations are categorized into the following groups based on the functionality they provide:

2. Create geometries

After you have selected the operation, the next step is to create one or more geometries with the same spatial reference. Geometry data is typically created through user interaction or by accessing features in a hosted feature layer.

In general, There are two different ways to create geometry data for analysis:

Below is an example of creating geometries programmatically using coordinates:

ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS API for Python
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

// create a point
const point = Geometry.fromJSON({
  type: "point",
  x: -3.83565819758263,
  y: 40.408142411681396,
  spatialReference: SpatialReference.WGS84,
})
// create a polyline
const line = Geometry.fromJSON({
  type: "polyline",
  paths: [
    [
      [-3.7611339616121, 40.39446064625446],
      [-3.6992634462656, 40.42167509407656],
      [-3.65292023890635, 40.39553309352415],
    ],
  ],
  spatialReference: SpatialReference.WGS84,

3. Perform the analysis

After you have created geometries, you can use them as parameters to one or more geometric operations.

The example below demonstrates how to pass the created geometries to client API operations:

ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS API for Python
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// buffer the input point
const buffer = geometryEngine.geodesicBuffer(point, 1000, "meters")

// Return the geodesic area of the new buffer
const area = geometryEngine.geodesicArea(buffer)
console.log("The area is:" + area)

// Determine if the buffer area and polyline intersect
const intersects = geometryEngine.intersects(buffer, line)
console.log("The geometries intersect: " + intersects)

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.