ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Offset Method
The geometry to calculate offset for. MapPoint and Multipoint are not supported.
The offset distance for the geometry.
The offset type of the offset geometry.
The ratio used to produce a bevel join instead of a miter join (used only when offsetType is miter).
Example

In This Topic
    Offset Method (GeometryEngine)
    In This Topic
    Returns offset version of the input geometry. The offset operation creates a geometry that is a constant distance from an input polyline or polygon. It is similar to buffering, but produces a one sided result. If offset distance > 0, then the offset geometry is constructed to the right of the oriented input geometry, otherwise it is constructed to the left. For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counter clockwise. So the "right side" of a simple polygon is always its inside. The bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be from the input curve before it is beveled.
    Syntax
    Public Function Offset( _
       ByVal geometry As Geometry, _
       ByVal distance As Double, _
       ByVal offsetType As OffsetType, _
       ByVal bevelRatio As Double _
    ) As Geometry

    Parameters

    geometry
    The geometry to calculate offset for. MapPoint and Multipoint are not supported.
    distance
    The offset distance for the geometry.
    offsetType
    The offset type of the offset geometry.
    bevelRatio
    The ratio used to produce a bevel join instead of a miter join (used only when offsetType is miter).

    Return Value

    Returns the result of the offset operation.
    Exceptions
    ExceptionDescription
    Geometry is null or empty.
    The method is not implemented for GeometryBag or Multipatch.
    Remarks

    GeometryEngine Offset

    Example
    Calculate a geometry offset from the source
    List<MapPoint> linePts = new List<MapPoint>();
    linePts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0, SpatialReferences.WGS84));
    linePts.Add(MapPointBuilderEx.CreateMapPoint(10.0, 1.0, SpatialReferences.WGS84));
    
    Polyline polyline = PolylineBuilderEx.CreatePolyline(linePts);
    
    Geometry g = GeometryEngine.Instance.Offset(polyline, 10, OffsetType.Square, 0);
    Polyline gResult = g as Polyline;
    // gResult.PointCount = 2
    // gResult.Points[0] = (1, -9)
    // gResult.Points[1] = (10, -9)
    
    g = GeometryEngine.Instance.Offset(polyline, -10, OffsetType.Round, 0.5);
    gResult = g as Polyline;
    // gResult.PointCount = 2
    // gResult.Points[0] = (1, -11
    // gResult.Points[1] = (10, 11)
    
    
    //
    // elliptic arc curve
    //
    Coordinate2D fromPt = new Coordinate2D(2, 1);
    Coordinate2D toPt = new Coordinate2D(1, 2);
    Coordinate2D interiorPt = new Coordinate2D(1 + Math.Sqrt(2) / 2, 1 + Math.Sqrt(2) / 2);
    
    EllipticArcSegment circularArc = EllipticArcBuilderEx.CreateCircularArc(fromPt.ToMapPoint(), toPt.ToMapPoint(), interiorPt);
    
    polyline = PolylineBuilderEx.CreatePolyline(circularArc);
    g = GeometryEngine.Instance.Offset(polyline, -0.25, OffsetType.Miter, 0.5);
    gResult = g as Polyline;
    
    g = GeometryEngine.Instance.Offset(polyline, 0.25, OffsetType.Bevel, 0.5);
    gResult = g as Polyline;
    
    
    //
    //  offset for a polygon
    //
    List<MapPoint> list = new List<MapPoint>();
    list.Add(MapPointBuilderEx.CreateMapPoint(10.0, 10.0, SpatialReferences.WGS84));
    list.Add(MapPointBuilderEx.CreateMapPoint(10.0, 20.0, SpatialReferences.WGS84));
    list.Add(MapPointBuilderEx.CreateMapPoint(20.0, 20.0, SpatialReferences.WGS84));
    list.Add(MapPointBuilderEx.CreateMapPoint(20.0, 10.0, SpatialReferences.WGS84));
    
    Polygon polygon = PolygonBuilderEx.CreatePolygon(list);
    
    g = GeometryEngine.Instance.Offset(polygon, 2, OffsetType.Square, 0);
    Polygon gPolygon = g as Polygon;
    
    g = GeometryEngine.Instance.Offset(polygon, -2, OffsetType.Round, 0.3);
    gPolygon = g as Polygon;
    
    g = GeometryEngine.Instance.Offset(polygon, -0.5, OffsetType.Miter, 0.6);
    gPolygon = g as Polygon;
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also