Public Sub buffTest(ByVal pFeature As IFeature, ByVal pMap As IMap)
Try
Dim pLayer As IFeatureLayer
Dim pCursor As IFeatureCursor = Nothing
Dim sName As String
sName = "clonelayer"
pLayer = FindLayerByName(sName, pMap)
Dim pFeat4Buff As IFeature
pFeat4Buff = pFeature
Dim pGeom As IGeometry = pFeat4Buff.Shape
Dim topoOperator As ITopologicalOperator = CType(pGeom, ITopologicalOperator)
Dim iBuffer As Long
Dim dBufferMiles As Double
dBufferMiles = 5
iBuffer = Int(dBufferMiles * 1609.3) 'convert miles to meters.
'iBuffer = 9000 'convert miles to meters.
Dim buffer As IGeometry
buffer = topoOperator.Buffer(iBuffer)
Dim pArea As IArea
pArea = buffer
MsgBox(pArea.Area / 4047, vbNormal, "Buffer Acres")
Catch ex As Exception
MsgBox("Buffer Error: " & ex.Message & " - Stack Trace: " & ex.StackTrace, vbInformation, "Buffer Select Error")
End Try
End SubIt is ALWAYS on the same polygon, and ONLY when dBufferMiles = 5. If I change the buffer to 4.9 or 5.1, or just about any other number I've tried, the buffer works fine.
Does this happen with only integer numbers as opposed to decimals or just 5 but not 6? Try forcing the number to a double data type as in
Dim dBufferMiles As Double = 5.0R
or
Dim dBufferMiles# = 5
Dang! Fast fingers, guys!
But, no. Forcing it to be an integer does not help. I tried that earlier, with no luck.
That error shows up somewhere in the depths of the ESRI web as an Internal Geometry Error, or something like that. I played around with some of the vertices and found a single vertex that, if moved, it would run fine. -T