ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / OffsetMs Method
The input geometry. Cannot be a GeometryBag.
The offset value to add to each M-value.
Example

In This Topic
    OffsetMs Method (IGeometryEngine)
    In This Topic
    Adds an offset value to each of the M-values.
    Syntax
    Function OffsetMs( _
       ByVal geometry As Geometry, _
       ByVal offset As Double _
    ) As Geometry

    Parameters

    geometry
    The input geometry. Cannot be a GeometryBag.
    offset
    The offset value to add to each M-value.

    Return Value

    A geometry with the offset value added to each of the M-values. If offset is NaN or geometry is empty, then the input geometry is returned unchanged.
    Exceptions
    ExceptionDescription
    Geometry is null.
    This geometry is not M-Aware.
    This method is not implemented for GeometryBag.
    Example
    Add an offset value to each of the M-values - OffsetMs
    {
      // Create a polyline and add an offset of 2 to each of the M-values
      MapPointBuilderEx pointBuilder = new(0, 0)
      {
        M = 1
      };
      MapPoint point1 = pointBuilder.ToGeometry();
    
      pointBuilder.SetValues(2, 2);
      pointBuilder.M = 3;
      MapPoint point2 = pointBuilder.ToGeometry();
    
      polyline = PolylineBuilderEx.CreatePolyline([point1, point2], AttributeFlags.HasM); ;
    
      Polyline outPolyline = GeometryEngine.Instance.OffsetMs(polyline, 2) as Polyline;
      // The xy-values of the points in outPolyline are the same as the points in the input polyline.
      // The M-values in outPolyline are { 3, 5 }
    
      // Create an envelope and add an offset of 25 to each of the M-values
      EnvelopeBuilderEx envelopeBuilder = new(-5, 1, 2, 4)
      {
        MMin = 10,
        MMax = 20
      };
      Envelope envelope = envelopeBuilder.ToGeometry();
    
      Envelope outEnvelope = GeometryEngine.Instance.OffsetMs(envelope, 25) as Envelope;
      // The xy-values of the points in outEnvelope are the same as the points in the input envelope.
      // outEnvelope.MMin = 35, outEnvelope.MMax = 45
    
      // Add a negative offset to the M-values of the envelope
      outEnvelope = GeometryEngine.Instance.OffsetMs(envelope, -10) as Envelope;
      // The xy-values of the points in outEnvelope are the same as the points in the input envelope.
      // outEnvelope.MMin = 0, outEnvelope.MMax = 10
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.3 or higher.
    See Also