You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcObjects General forum

Buffer inside   Gareth Mann May 07, 2003
Re: Buffer inside   Neil Clemmons May 07, 2003
Re: Buffer inside   Gareth Mann May 07, 2003
Re: Buffer inside   Neil Clemmons May 07, 2003
Re: Buffer inside   Gareth Mann May 09, 2003
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Buffer inside 
Author Gareth Mann 
Date May 07, 2003 
Message Using the Buffer Wizard in ArcMap, there are 4 different buffer operations that one has a choice to perform:

1, Inside and Outside polygons

2, Only Outside the polygon

3, Only inside the polygon

4, Outside polygons and include inside

However using itopologicalop.buffer, only number 4 is possible, I want to be able to do number 3. I tried using a negative number as the buffer distance but that just gave me a graphic that was a shrunken version of the polygon (shrunk down by the buffer distance) rather than a buffer from the outside inwards. Does anybody know how to get this? Is there another ArcObject I can use? 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Buffer inside 
Author Neil Clemmons 
Date May 07, 2003 
Message Much of the functionality in ArcMap is a combination of ArcObjects methods. In order to accomplish #3, you would use Buffer with a negative number. Take the resulting geometry and subtract it from the original geometry using Difference. This should leave you with a geometry that is the buffer along the inside of the original geometry boundary. All of the options can be accomplished using the methods available on the ITopoOp interface. You just have to figure out which ones you need and what order to call them in. 
  Neil Clemmons
Senior GIS Developer
Geographic Information Services, Inc.
Birmingham, AL
http://www.gis-services.com

Check out our blog:
http://blog.gis-services.com/ 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Buffer inside 
Author Gareth Mann 
Date May 07, 2003 
Message What about ifeaturecursorbuffer? This has a property called "polygonbuffertype" which can be set to 'esribufferinside'.
However I have tried using it by adapting someone elses script( http://forums.esri.com/Thread.asp?c=93&f=992&t=63659&mc=2#msgid164249 ) which I copied and pasted and it worked fine. But with my adaption(see code below) it crashes on:

pFeatCursorBuff.buffer pFeatClassName

with 'automation error, unspecified error'

Any idea whats wrong? 
 
Public Function bufferIn(pFeatclass As IFeatureClass, lbuffDist As Long, sName As String, sPath As String) As IFeatureClass
'This function takes a feature class and buffers inwards by a specified distance and then saves it as a new shapefile feature class
'the newly saved feature class is then returned from the function

'dim the ArcVariables:
Dim pFeatCursorBuff As IFeatureCursorBuffer
Dim pFeatCursor As IFeatureCursor
Dim pFeatClassName As IFeatureClassName
Dim pWorkspaceName As IWorkspaceName
Dim pDatasetName As IDatasetName
Dim pBufferProcessParam As IBufferProcessingParameter


'set the info for the output feature class
Set pFeatClassName = New FeatureClassName
Set pDatasetName = pFeatClassName
Set pWorkspaceName = New WorkspaceName

'......first the workspace:
With pWorkspaceName
    .PathName = sPath & ".shp"
    .WorkspaceFactoryProgID = "esricore.shapefileworkspacefactory.1"
End With

Set pDatasetName.WorkspaceName = pWorkspaceName

'......then the feature class:
With pFeatClassName
    .FeatureType = esriFTSimple
    .ShapeFieldName = "Shape"
    .ShapeType = esriGeometryPolygon
End With


Set pFeatCursor = pFeatclass.Search(Nothing, False)
Set pFeatCursorBuff = New FeatureCursorBuffer

'.....then set the info for the buffer operation:
Set pFeatCursorBuff.FeatureCursor = pFeatCursor

With pFeatCursorBuff
    .PolygonBufferType = esriBufferInside
    .Units(esriMeters) = esriMeters
    .ValueDistance = lbuffDist
End With

'and for the processing parameters:
Set pBufferProcessParam = pFeatCursorBuff
Set pBufferProcessParam.FeatureClass = pFeatclass
With pBufferProcessParam
    .AdjustCirclesForProjection = True
    .SimplifyShapes = True
    .InputHasPolygons = True
    .SaveAsGraphics = False
End With

pFeatCursorBuff.buffer pFeatClassName


'now release the variables:
Set pFeatCursorBuff = Nothing
Set pFeatCursor = Nothing
Set pFeatClassName = Nothing
Set pWorkspaceName = Nothing
Set pDatasetName = Nothing


End Function
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Buffer inside 
Author Neil Clemmons 
Date May 07, 2003 
Message My guess is that the feature class name object is invalid. Glancing at your code, I see that you are appending .shp to the path when attempting to create the workspace name object. This is incorrect. A shapefile workspace is a directory, not a file, so it will not have an extension. I also do not see where you are specifying what feature class the feature class name object is referencing. I believe you do this through the dataset name object. I don't work with the name objects very much and it's been quite some time since I've used one, so there may be other things wrong that I don't see. 
  Neil Clemmons
Senior GIS Developer
Geographic Information Services, Inc.
Birmingham, AL
http://www.gis-services.com

Check out our blog:
http://blog.gis-services.com/ 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Buffer inside 
Author Gareth Mann 
Date May 09, 2003 
Message yes, you're right I made a mistake. But that still has not fixed the problem, I still get the same error message.

Gareth