ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / LineSegment Class
Members Example

In This Topic
    LineSegment Class
    In This Topic
    A class representing a straight line between a start and end point for use in a Multipart geometry. To create a line segment use the LineBuilderEx object.
    Object Model
    LineSegment ClassCoordinate2D StructureMapPoint ClassEnvelope ClassSpatialReference ClassCoordinate2D StructureMapPoint Class
    Syntax
    public sealed class LineSegment : Segment 
    Public NotInheritable Class LineSegment 
       Inherits Segment
    Remarks

    Line Segment

    Example
    StartPoint of a Polyline
    // Method 1: Get the start point of the polyline by converting the polyline 
    //    into a collection of points and getting the first point
    
    // sketchGeometry is a Polyline
    // get the sketch as a point collection
    var pointCol = ((Multipart)sketchGeometry).Points;
    // Get the start point of the line
    var firstPoint = pointCol[0];
    
    // Method 2: Convert polyline into a collection of line segments 
    //   and get the "StartPoint" of the first line segment.
    var polylineGeom = sketchGeometry as ArcGIS.Core.Geometry.Polyline;
    var polyLineParts = polylineGeom.Parts;
    
    ReadOnlySegmentCollection polylineSegments = polyLineParts.First();
    
    //get the first segment as a LineSegment
    var firsLineSegment = polylineSegments.First() as LineSegment;
    
    //Now get the start Point
    var startPoint = firsLineSegment.StartPoint;
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Geometry.Segment
          ArcGIS.Core.Geometry.LineSegment

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also