Introduction to geometry operators

The ArcGIS Maps SDK for JavaScript provides a variety of capabilities for performing client-side geometric operations on points, multipoints, lines, polygons and extents.

Categories

The geometry operators are grouped into ten functional categories: bounding, densify and generalize, feature to point, linear referencing, linear transformations, measurements, projection, nearest, spatial relationships, and topological operations.

Bounding

Bounding operators are used to determine an enclosing shape around a more complex geometric object. This is used to quickly test for potential collisions or overlaps with other objects without needing to check every detail of the original geometry. The result geometry can be used to significantly improve the performance of spatial analysis.

alphaShapeOperator, boundaryOperator, convexHullOperator, minimumBoundingCircleOperator

Densify and generalize

Densifying a multipart geometry adds more vertices at regular intervals. Generalizing a multipart geometry simplifies it by removing vertices while preserving its general shape.

densifyOperator, generalizeOperator, geodeticDensifyOperator

Feature to point

Feature to point operations are used to locate a specific interior point in a polygon or extent.

centroidOperator, labelPointOperator

Linear referencing

Linear referencing is a method for determining geographic locations as relative positions between or along a measured line feature.

locateBetweenOperator

Linear transformations

Linear transformations involve altering the spatial location, shape, or orientation of geographic data by manipulating the coordinates and include flipX, flipY, scale and more.

affineTransformOperator

Measurements

Measurement operations are for determining the dimensions of geometric shapes.

areaOperator, distanceOperator, geodeticAreaOperator, geodeticDistanceOperator, geodeticLengthOperator, lengthOperator

Nearest

Nearest operations are for determining aspects of the physical closeness of one geometry to another.

geodesicProximityOperator, isNearOperator, proximityOperator

Projection

Projection operations involve transforming the vertices of geometries from one spatial reference to another.

projectOperator, shapePreservingProjectOperator

Spatial relationships

Spatial relationships are about understanding where geometries are in relation to each other to define their arrangement and interactions.

containsOperator, crossesOperator, disjointOperator, equalsOperator, intersectsOperator, intersectionOperator, overlapsOperator, relateOperator, touchesOperator, and withinOperator

Topological

Topological operations are about changing the shape of an object while maintaining its fundamental structure in terms of how parts are connected to each other. The result is the creation of a new geometry.

autoCompleteOperator, bufferOperator, clipOperator, cutOperator, differenceOperator, geodesicBufferOperator, graphicBufferOperator, extendOperator, integrateOperator, multiPartToSinglePartOperator, offsetOperator, polygonOverlayOperator, reshapeOperator, linesToPolygonsOperator, polygonSlicerOperator, simplifyOGCOperator, simplifyOperator, symmetricDifferenceOperator, unionOperator

Working with spatial relationship operators

Dimensionality

The concept of dimensions is important in determining the spatial relationship of two features. The dimensions of the features are examined to determine how they should be compared. The dimension of the resulting feature or features determines whether or not the operation was successful.

The dimensions of a geometry are the minimum coordinates (none, x, y) required to define the spatial extent of the geometry. A geometry can have a dimension of 0, 1, or 2. The dimensions are as follows:

  • 0 — Has neither length nor area
  • 1 — Has a length (x or y)
  • 2 — Contains area (x and y)

Point and multipoint features have a dimension of 0, polylines a dimension of 1, and extents and polygons a dimension of 2. The presence of z-coordinates or m-coordinates does not affect the dimensionality of the geometry.

Acceleration

If you are performing relational operations on the same polygon or polyline multiple times by comparing it to different geometries, you may want to accelerate the geometry to improve performance. Acceleration constructs optimized data structures (a spatial index, for example) useful to an operator and attaches them to the geometry. Thereafter, the operator can take advantage of the acceleration to execute more efficiently.

Accelerating a geometry can be time consuming and it uses more memory than a non-accelerated geometry; for a single shot usage of an operator, accelerating first will take more time than skipping acceleration. The time to accelerate versus the performance gain depends on the number of vertices in the geometry. If the geometry has a large number of vertices, for example more than 10,000, then you may see a performance gain from acceleration even if you are using it only ten times. If the geometry has a small number of vertices, for example less than 200, you may not see a performance gain from acceleration unless you are using it more than 100 to 200 times.

The result of any operation will be unaffected by the presence or absence of accelerations on any geometry. You can also pass an accelerated geometry to non-relational operators and the acceleration structures will be ignored. Acceleration is optional and only applicable to some (for example relational) operators.

Use an accelerated geometry

Each relational operator has an accelerateGeometry() method that returns a boolean. Pass the geometry that you want accelerated to the method and it will return true if the acceleration is successful. The method will return false if the optimization isn't useful for the operator's input. For example, accelerating a point will always return false.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
// Returns true if the polygon has been accelerated
const accelerated = containsOperator.accelerateGeometry(polygon);

if (accelerated) {
  // Use the accelerated polygon in an iterative function
  const results = featuresSet.map((feature) => {
    const contained = containsOperator.execute(polygon, feature.geometry);
    return {
      feature,
      contained
    };
  });
}

Working with geodetic operators

Geodetic curve types

A curve type is how the connection between vertices is interpreted. A geodetic curve is a curve defined on the surface of a spheroid. To represent a geodetic curve on a flat map, the output is densified. The start and end vertices are not affected by densification, only the intermediate vertices are affected.

The SDK supports five geodetic curve types when working with the following: geodesicBufferOperator, geodeticAreaOperator, geodeticDensifyOperator, geodeticDistanceOperator and geodeticLengthOperator. Except for the shape-preserving type, the other four types replace the connection between two vertices, that were connected by some segment, with a given geodetic curve. Shape preserving typically means a new geometry is created that approximates the given geodetic path using a densified representation.

  • geodesic - Defines the shortest distance between any two points.

  • great-elliptic - Defined by the intersection of a plane that contains the center of the spheroid and the spheroid surface and passes through two points. This is also known as a great circle when a sphere is used. It is not necessarily the shortest path between two points.

  • loxodrome - Defined by the line of constant bearing, or azimuth, between two points. It represents a rhumb-line path on the earth that crosses each meridian at the same acute angle, thus forming a spiral that converges on the north or south pole. The Mercator projection shows loxodromes as straight lines.

  • normal-section - Defined by the intersection of a plane that passes through two points on the surface of the spheroid and is perpendicular to the surface at the first point. It is not necessarily the shortest path between two points.

  • shape-preserving - The segment shape is preserved in the projection where it is defined. This is often used in situations where maintaining the visual representation of a feature is crucial, like when working with boundaries or coastlines.

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