ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / DensifyByLength Method
The geometry to be densified.
The maximum segment length allowed in the output geometry.

In This Topic
    DensifyByLength Method (GeometryEngine)
    In This Topic
    Densifies the specified geometry.
    public Geometry DensifyByLength( 
       Geometry geometry,
       double maxSegmentLength
    Public Function DensifyByLength( _
       ByVal geometry As Geometry, _
       ByVal maxSegmentLength As Double _
    ) As Geometry


    The geometry to be densified.
    The maximum segment length allowed in the output geometry.

    Return Value

    Returns the densified geometry. If the input geometry is empty, then it is returned unchanged.
    Geometry is null.
    The method is not implemented for GeometryBag or Multipatch.
    Geometry is null.
    The densify operation adds vertices to the input geometry.

    GeometryEngine DensifyByLength

    Densify by Length
    // densify a line segment
    MapPoint startPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0);
    MapPoint endPt = MapPointBuilderEx.CreateMapPoint(1, 21);
    LineSegment line = LineBuilderEx.CreateLineSegment(startPt, endPt);
    Polyline polyline = PolylineBuilderEx.CreatePolyline(line);
    Geometry geom = GeometryEngine.Instance.DensifyByLength(polyline, 2);
    Polyline result = geom as Polyline;
    // densify a circular arc
    MapPoint fromPt = MapPointBuilderEx.CreateMapPoint(2, 1);
    MapPoint toPt = MapPointBuilderEx.CreateMapPoint(1, 2);
    Coordinate2D interiorPt = new Coordinate2D(1 + Math.Sqrt(2) / 2, 1 + Math.Sqrt(2) / 2);
    EllipticArcBuilderEx cab = new EllipticArcBuilderEx(fromPt, toPt, interiorPt);
    EllipticArcSegment circularArc = cab.ToSegment();
    polyline = PolylineBuilderEx.CreatePolyline(circularArc);
    geom = GeometryEngine.Instance.DensifyByLength(polyline, 2);
    result = geom as Polyline;

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also