ArcGIS Pro 2.7 API Reference Guide
GeodeticDensifyByLength Method (GeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > GeometryEngine Class : GeodeticDensifyByLength Method
The geometry to be densified.
The maximum segment length allowed. If maxSegmentLength is less than or equal to zero, the value of 50 km is used.
The linear unit of maxSegmentLength.
The type of curve that connects the vertices of the densified geometry.
Creates geodetic segments connecting existing vertices and densifies the segments.
Syntax
Public Function GeodeticDensifyByLength( _
   ByVal geometry As Geometry, _
   ByVal maxSegmentLength As Double, _
   ByVal lengthUnit As LinearUnit, _
   ByVal curveType As GeodeticCurveType _
) As Geometry

Parameters

geometry
The geometry to be densified.
maxSegmentLength
The maximum segment length allowed. If maxSegmentLength is less than or equal to zero, the value of 50 km is used.
lengthUnit
The linear unit of maxSegmentLength.
curveType
The type of curve that connects the vertices of the densified geometry.

Return Value

The densified geometry.
Exceptions
ExceptionDescription
Geometry is null or empty.
The method is not implemented for GeometryBag or Multipatch.
The geomtry is of an incorrect type. (i.e. a point or multipoint).
Geometry does not have a spatial reference.
Spatial reference of geometryis an image coordinate system.
Remarks
The image below shows the results of applying the GeodeticDensify method to a polyline with curveType = Geodesic. The densified polyline represents a flight path between stops in Honolulu and Los Angeles. The original polyline is modified by adding additional segments that identify the shortest ground distance between these locations.

GeometryEngine Geodesic Densify

Example
List<Coordinate2D> coords = new List<Coordinate2D>()
{
  new Coordinate2D(-80, 0),
  new Coordinate2D(-20, 60),
  new Coordinate2D(40, 20),
  new Coordinate2D(0, -20),
  new Coordinate2D(-80, 0)
};

SpatialReference sr = SpatialReferences.WGS84;

// create a polygon
Polygon polygon = PolygonBuilder.CreatePolygon(coords, sr);

// get the geodesic lengths of the polygon segments
ReadOnlySegmentCollection segments = polygon.Parts[0];
List<Double> geoLengths = new List<Double>(segments.Count);
foreach (Segment s in segments)
{
  Polyline line = PolylineBuilder.CreatePolyline(s, sr);
  double geoLen = GeometryEngine.Instance.GeodesicLength(line);
  geoLengths.Add(geoLen);
}

// find the max length
geoLengths.Sort();
double maxLen = geoLengths[geoLengths.Count - 1];

// densify the polygon (in meters)
Polygon densifiedPoly = GeometryEngine.Instance.GeodeticDensifyByLength(polygon, maxLen, LinearUnit.Meters, GeodeticCurveType.Geodesic) as Polygon;

// densify the polygon (in km)
double maxSegmentLength = maxLen / 10000;
densifiedPoly = GeometryEngine.Instance.GeodeticDensifyByLength(polygon, maxSegmentLength, LinearUnit.Kilometers, GeodeticCurveType.Geodesic) as Polygon;
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

GeometryEngine Class
GeometryEngine Members