ArcObjects Library Reference  (Geometry)    

ITopologicalOperator.Buffer Method

Constructs a polygon that is the locus of points at a distance less than or equal to a specified distance from this geometry.

[Visual Basic 6.0]
Function Buffer(
    ByVal distance As Double _
) As IGeometry
[Visual Basic .NET]
Public Function Buffer ( _
    ByVal distance As Double _
) As IGeometry
[C#]
public IGeometry Buffer (
    double distance
);
[Java]
public IGeometry buffer (
    double distance
)
throws
    IOException,
    AutomationException
[C++]
HRESULT Buffer(
  double distance,
  IGeometry** outBuffer
);
[C++]

Parameters

distance

  distance is a parameter of type double

outBuffer [out, retval]

  outBuffer is a parameter of type IGeometry

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks


The buffer distance is in the same units as the source shape that is being buffered.

A negative distance can be specified to produce a buffer inside the original polygon. This cannot be used with polyline. ITopologicalOperator methods must be applied on top-level geometries only. Top-Level geometries are point, multipoint, polyline and polygon. To use this method with segments (Line, Circular Arc, Elliptic Arc, Bézier Curve), paths or rings, they must be wrapped with a top-level type.

Buffer Example

[C#]

//The following code shows to wrap a line segment into a polyline in C#

//Assume a line (line1 as ILine) is already created

object obj = Type.Missing;

ISegmentCollection segCollection = new PolylineClass() as ISegmentCollection;

segCollection.AddSegment((ISegment)line1, ref obj, ref obj);

//Set the spatial reference on the new polyline

//The spatial reference is not transfered automatically from the segments

IGeometry geom = segCollection as IGeometry;

geom.SpatialReference = spatialRef;

//Can now be used with ITopologicalOperator methods

 

[Visual Basic 6.0]

'How to wrap a line segment into a polyline in VB6

'Assume a line (pLine as ILine) is already created

dim psc as ISegmentCollection

set psc = New Polyline

psc.addsegment pline

'Set the spatial reference on the new polyline

'The spatial reference is not transfered automatically from the segments

dim pgeo as IGeometry

set pgeo = psc

set pgeo.SpatialReference = pMyspatialReference

'Can now be used with ITopologicalOperator methods

See Also

ITopologicalOperator Interface

Example

Buffer_Example