ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Clip Method
The geometry to be clipped by the given envelope.
A geometry that represents the area clipped by envelope.

In This Topic
    Clip Method (GeometryEngine)
    In This Topic
    Constructs the polygon created by clipping geometry by envelope.
    Public Function Clip( _
       ByVal geometry As Geometry, _
       ByVal envelope As Envelope _
    ) As Geometry


    The geometry to be clipped by the given envelope.
    A geometry that represents the area clipped by envelope.

    Return Value

    The clipped geometry.
    Either geometry or envelope or both are null or empty.
    The method is not implemented for GeometryBag.
    Incompatible spatial references between the input geometries.
    If the input geometry is a multipatch, then the multipatch is projected to the 2D-plane. The output geometry will be a polygon.

    GeometryEngine Clip

    Clip a Polyline
    // clip a polyline by an envelope
    Envelope env = EnvelopeBuilderEx.CreateEnvelope(2.0, 2.0, 4.0, 4.0);
    LineSegment line = LineBuilderEx.CreateLineSegment(new Coordinate2D(0, 3), new Coordinate2D(5.0, 3.0));
    Polyline polyline = PolylineBuilderEx.CreatePolyline(line);
    Geometry clipGeom = GeometryEngine.Instance.Clip(polyline, env);
    Clip a Polyline by a Polygon
    // clip a polyline by a polygon
    List<Coordinate2D> list = new List<Coordinate2D>();
    list.Add(new Coordinate2D(1.0, 1.0));
    list.Add(new Coordinate2D(1.0, 4.0));
    list.Add(new Coordinate2D(4.0, 4.0));
    list.Add(new Coordinate2D(4.0, 1.0));
    Polygon polygon = PolygonBuilderEx.CreatePolygon(list, SpatialReferences.WGS84);
    LineSegment crossingLine = LineBuilderEx.CreateLineSegment(MapPointBuilderEx.CreateMapPoint(0, 3), MapPointBuilderEx.CreateMapPoint(5.0, 3.0));
    Polyline p = PolylineBuilderEx.CreatePolyline(crossingLine);
    Geometry geometry = GeometryEngine.Instance.Clip(p, polygon.Extent);

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also