ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / GeodesicBuffer Method / GeodesicBuffer(Geometry,Double) Method
The input geometry. Cannot be null and its spatial reference cannot be null.
The distance (in meters) to buffer the geometry.
Example

In This Topic
    GeodesicBuffer(Geometry,Double) Method
    In This Topic
    Creates a buffer polygon at the specified geodesic distance around the given geometry.
    Syntax
    Overloads Function GeodesicBuffer( _
       ByVal geometry As Geometry, _
       ByVal distance As Double _
    ) As Geometry

    Parameters

    geometry
    The input geometry. Cannot be null and its spatial reference cannot be null.
    distance
    The distance (in meters) to buffer the geometry.

    Return Value

    A geometry representing the buffered area. If the input geometry is empty, then an empty polygon is returned.
    Exceptions
    ExceptionDescription
    Geometry is null or empty. Or geometry's spatial reference is null.
    The method is not implemented for GeometryBag.
    Geometry has no spatial reference.
    The buffer distance must be a valid floating point number.
    Spatial reference of geometryis an image coordinate system.
    Remarks
    Geodesic distance is the shortest distance between two points on the surface of the Earth.

    If the buffer distance is zero and the input geometry is a polygon or an envelope, then a polygon created from the input geometry is returned.

    If the distance is less than or equal to zero and the input geometry is not a polygon or an envelope, then an empty polygon is returned.

    Example
    Create a buffer polygon at the specified geodesic distance
    // buffer a point
    MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0, SpatialReferences.WGS84);
    Polygon outPolygon = GeometryEngine.Instance.GeodesicBuffer(pt, 5) as Polygon;
    
    double delta = SpatialReferences.WGS84.XYTolerance * 2 * Math.Sqrt(2);
    ReadOnlyPointCollection points = outPolygon.Points;
    foreach (MapPoint p in points)
    {
      double d = GeometryEngine.Instance.GeodesicDistance(pt, p);
      // d = 5 (+- delta)
    }
    
    // specify a unit for the distance
    outPolygon = GeometryEngine.Instance.GeodesicBuffer(pt, 5000, LinearUnit.Millimeters) as Polygon;
    
    // buffer of 0 distance produces an empty geometry
    Geometry g = GeometryEngine.Instance.GeodesicBuffer(pt, 0);
    // g.IsEmpty = true
    
    // buffer many points
    List<MapPoint> list = new List<MapPoint>();
    list.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0, SpatialReferences.WGS84));
    list.Add(MapPointBuilderEx.CreateMapPoint(10.0, 20.0));
    list.Add(MapPointBuilderEx.CreateMapPoint(40.0, 40.0));
    list.Add(MapPointBuilderEx.CreateMapPoint(60.0, 60.0));
    
    outPolygon = GeometryEngine.Instance.GeodesicBuffer(list, 10000) as Polygon;
    // outPolygon.PartCount = 4
    
    // buffer different geometry types
    List<Coordinate2D> coords = new List<Coordinate2D>()
    {
      new Coordinate2D(1, 2), new Coordinate2D(10, 20), new Coordinate2D(20, 30),
      new Coordinate2D(50, 60), new Coordinate2D(70, 80), new Coordinate2D(80, 40),
      new Coordinate2D(90, 10), new Coordinate2D(110, 15), new Coordinate2D(120, 30),
      new Coordinate2D(10, 40), new Coordinate2D(-10, 40), new Coordinate2D(-10, 50)
    };
    
    List<Geometry> manyGeometries = new List<Geometry>
    {
      MapPointBuilderEx.CreateMapPoint(1.0, 1.0, SpatialReferences.WGS84),
      PolylineBuilderEx.CreatePolyline(new List<Coordinate2D>(){coords[0], coords[1], coords[2]}, SpatialReferences.WGS84),
      PolylineBuilderEx.CreatePolyline(new List<Coordinate2D>(){coords[3], coords[4], coords[5]}),
      PolygonBuilderEx.CreatePolygon(new List<Coordinate2D>(){coords[9], coords[10], coords[11]})
    };
    
    outPolygon = GeometryEngine.Instance.GeodesicBuffer(manyGeometries, 20000) as Polygon;
    
    // specify unit types
    outPolygon = GeometryEngine.Instance.GeodesicBuffer(manyGeometries, 20, LinearUnit.Miles) as Polygon;
    
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also