ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Buffer Method / Buffer(IEnumerable<Geometry>,Double) Method
Specifies the input geometries.
The distance (in the unit of the geometry's spatial reference) to buffer the geometries.
Example

In This Topic
    Buffer(IEnumerable<Geometry>,Double) Method
    In This Topic
    Creates buffers at the specified distance around the given geometries. Will union the results of all buffers.
    Syntax
    Public Overloads Function Buffer( _
       ByVal geometries As IEnumerable(Of Geometry), _
       ByVal distance As Double _
    ) As Geometry

    Parameters

    geometries
    Specifies the input geometries.
    distance
    The distance (in the unit of the geometry's spatial reference) to buffer the geometries.

    Return Value

    The polygon that represents the buffered area.
    Exceptions
    ExceptionDescription
    Geometries is null or empty.
    The method is not implemented for GeometryBag.
    The buffer distance must be a valid floating point number.
    Remarks
    The returned polygon is the union of all the buffered geometries.

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

    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 created.

    The spatial reference of the output geometries is the first not null or unknown spatial reference found in the list of geometries. All other geometries are projected to this spatial reference, if necessary. If no such spatial reference is found, then the unknown spatial reference is used if it is found in the list. Otherwise, the spatial reference is null.

    Example
    Zoom to a specified point
    //Create a point
    var pt = MapPointBuilderEx.CreateMapPoint(x, y, 
                   SpatialReferenceBuilder.CreateSpatialReference(4326));
    //Buffer it - for purpose of zoom
    var poly = GeometryEngine.Instance.Buffer(pt, buffer_size);
    
    //do we need to project the buffer polygon?
    if (!MapView.Active.Map.SpatialReference.IsEqual(poly.SpatialReference))
    {
      //project the polygon
      poly = GeometryEngine.Instance.Project(poly, MapView.Active.Map.SpatialReference);
    }
    
    // Must run on MCT.
    QueuedTask.Run(() =>
    {
      //Zoom - add in a delay for animation effect
      MapView.Active.ZoomTo(poly, new TimeSpan(0, 0, 0, 3));
    });
    
    Buffer multiple MapPoints
    // creates a buffer around each MapPoint
    
    List<MapPoint> pts = new List<MapPoint>();
    pts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0));
    pts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 2.0));
    pts.Add(MapPointBuilderEx.CreateMapPoint(2.0, 2.0));
    pts.Add(MapPointBuilderEx.CreateMapPoint(2.0, 1.0));
    
    Geometry ptsBuffer = GeometryEngine.Instance.Buffer(pts, 0.25);
    Polygon bufferResult = ptsBuffer as Polygon;      // bufferResult will have 4 parts
    
    Buffer many different Geometry Types
    List<Coordinate2D> coords = new List<Coordinate2D>()
    {
        new Coordinate2D(1, 2), new Coordinate2D(3, 4), new Coordinate2D(4, 2),
        new Coordinate2D(5, 6), new Coordinate2D(7, 8), new Coordinate2D(8, 4),
        new Coordinate2D(9, 10), new Coordinate2D(11, 12), new Coordinate2D(12, 8),
        new Coordinate2D(10, 8), new Coordinate2D(12, 12), new Coordinate2D(14, 10)
    };
    
    List<Geometry> manyGeometries = new List<Geometry>
    {
        MapPointBuilderEx.CreateMapPoint(coords[9]),
        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[6], coords[7], coords[8]})
    };
    
    Geometry manyGeomBuffer = GeometryEngine.Instance.Buffer(manyGeometries, 0.25);
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also