intersection static method
Calculates the intersection of two geometries.
The result has the same dimensionality as the lower dimensionality of the two intersecting geometries. If there is no intersection with this dimensionality, returns an empty geometry. For example, the intersection of two polygons (geometries with area, so they have dimensionality of 2) or, say, a polygon and an envelope (also an area) is a polygon. Similarly, the intersection of a polyline (a line, so dimensionality of 1) and another polyline is always a polyline. Therefore when computing the intersection of polylines, this function does not return points where they cross, but rather lines of overlap. If there are no lines of overlap, an empty polyline is returned even if the input lines cross. To obtain all intersections, irrespective of dimensionality, see GeometryEngine.intersections.
Returns an empty geometry if the two input geometries do not intersect.
Supports true curves.
Parameters:
geometry1
— A geometry object.geometry2
— Another geometry object.
Return Value: A geometry object that represents the intersection of the given geometries.
Implementation
static Geometry intersection({
required Geometry geometry1,
required Geometry geometry2,
}) {
_initializeArcGISEnvironmentIfNeeded();
final objectHandle = _withThrowingErrorHandler((errorHandler) {
return runtimecore.RT_GeometryEngine_intersection(
geometry1._handle,
geometry2._handle,
errorHandler,
);
});
return Geometry._fromHandle(
objectHandle,
)!;
}