Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a bit of help with using the iBufferContruction interface, my overall goal is that the user clicks on the map, a graphic is created and then buffered,at multiple distances and then stored in a featureclass

So far, i can create a single buffer (i know if it created because the length that gets returned is correct), however when I store it in my FC the shape is empty.

Here's the code:

Private Sub Buffer_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)

'Get the location of the mouse and set it to the point
Set m_pPoint = m_pMxDoc.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)

'new marker element on the map
Set m_pElement = New MarkerElement

'set the element property
m_pElement.Geometry = m_pPoint

Set m_pGraphics = m_pMap

m_pGraphics.AddElement m_pElement, 0 'Grpahic for the point click.

Set m_pAC = m_pMxDoc.ActiveView

'refresh the map
m_pAC.PartialRefresh esriViewGraphics, Nothing, Nothing
Dim pPoly As IPolygon4
Set pPoly = New Polygon

'Dim pPoly As IPolygonElement
'Set pPoly = New PolygonElement

Dim pBC As IBufferConstruction
Set pBC = New BufferConstruction

'Dim pBCProp As IBufferConstructionProperties
'Set pBCProp = pBC
'pBCProp.ExplodeBuffers = True

Set pPoly = pBC.Buffer(m_pElement.Geometry, 200)
Debug.Print pPoly.Length ' RETURNS 1256.63706143592

Dim pFeat As IFeature
Dim pfeatureCursor As IFeatureCursor
Dim pfeatureBuffer As IFeatureBuffer

Set pfeatureBuffer = m_pBufferFClass.CreateFeatureBuffer
Set pfeatureCursor = m_pBufferFClass.Insert(True)
Set pFeat = pfeatureBuffer

pfeatureCursor.InsertFeature pfeatureBuffer
Set pFeat.Shape = pPoly

m_pAC.PartialRefresh esriViewGeography, Nothing, Nothing

Where am I going wrong? Also has anyone got any code examples with creating multiple buffers at various distances?

share|improve this question

Stupid mistake the line

Set pFeat.Shape = pPoly

should have been above

pfeatureCursor.InsertFeature pfeatureBuffer
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.