ArcGIS Developer Help  (Geometry)    

Buffer Example

'This example demonstrates how to use ITopologicalOperator::Buffer

Sub exampleITopologicalOperator_Buffer()
Dim ptc As IPointCollection, i As Long, pa As IArea, ptopo As ITopologicalOperator
Dim pt(4) As IPoint, poutPoly As IPolygon
Set ptc = New Polygon
'The spatial reference should be set here using IGeometry::SpatialReference (Code skipped here)
For i = 0 To 4
   Set pt(i) = New Point
pt(0).PutCoords 0, 0
pt(1).PutCoords 0, 10
pt(2).PutCoords 10, 10
pt(3).PutCoords 10, 0
pt(4).PutCoords 0, 0
ptc.AddPoints 5, pt(0)
Set pa = ptc
Debug.Print "Area original polygon : " & pa.Area
Set ptopo = ptc
Set poutPoly = ptopo.Buffer(1) 'Outside buffer
Set pa = poutPoly
Debug.Print "Area polygon positive distance : " & pa.Area
Set poutPoly = ptopo.Buffer(-1) 'Inside buffer
Set pa = poutPoly
Debug.Print "Area polygon negative distance : " & pa.Area
End Sub

[Visual Basic .NET, C#, C++]
No example is available for Visual Basic .NET, C#, or C++. To view a Visual Basic 6.0 example, click the Language Filter button Language Filter in the upper-left corner of the page.