ESRI.ArcGIS.ADF.IMS
CreateBufferLayer Method
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace > FeatureLayer Class : CreateBufferLayer Method




filter
Filter of features to be buffered.
displayBuffer
DisplayBuffer that will be displayed on the created FeatureLayer.
bufferRenderer
Renderer of the DisplayBuffer on the created FeatureLayer.
newLayerID
ID of the created FeatureLayer.
Creates a buffer layer for map display based on the current FeatureLayer and a given display buffer.

Syntax

Visual Basic (Declaration) 
Public Function CreateBufferLayer( _
   ByVal filter As Filter, _
   ByVal displayBuffer As DisplayBuffer, _
   ByVal bufferRenderer As Renderer, _
   ByVal newLayerID As String _
) As FeatureLayer
Visual Basic (Usage)Copy Code
Dim instance As FeatureLayer
Dim filter As Filter
Dim displayBuffer As DisplayBuffer
Dim bufferRenderer As Renderer
Dim newLayerID As String
Dim value As FeatureLayer
 
value = instance.CreateBufferLayer(filter, displayBuffer, bufferRenderer, newLayerID)
C# 
public FeatureLayer CreateBufferLayer( 
   Filter filter,
   DisplayBuffer displayBuffer,
   Renderer bufferRenderer,
   string newLayerID
)

Parameters

filter
Filter of features to be buffered.
displayBuffer
DisplayBuffer that will be displayed on the created FeatureLayer.
bufferRenderer
Renderer of the DisplayBuffer on the created FeatureLayer.
newLayerID
ID of the created FeatureLayer.

Return Value

Created buffer layer.

Example

The following example creates a buffer layer that selects from an existing layer and draws a buffer around the selected features. It adds this buffer layer to the map and draws the map to display it. This example assumes an existing MapView object.
C#Copy Code
// Create a filter and buffer to use with the the buffer layer 

Filter layerFilter = new Filter("NAME = 'Mekong'"); 

DisplayBuffer layerBuffer = new DisplayBuffer(100.0, BufferUnits.Kilometers); 

  

// Create a renderer for the buffer--polygon type since buffer is a polygon 

SimpleFillSymbol bufferSymbol =  

    new SimpleFillSymbol(System.Drawing.Color.Yellow,  

    System.Drawing.Color.Yellow, PolygonFillType.FDiagonal); 

SimpleRenderer bufferRenderer = new SimpleRenderer(bufferSymbol); 

  

// Create buffer layer from an existing layer 

FeatureLayer originalLayer = 

    (FeatureLayer)mapView.Layers.FindByName("Rivers"); 

FeatureLayer bufferLayer = 

    originalLayer.CreateBufferLayer(layerFilter, layerBuffer,  

    bufferRenderer, "riverBuffer"); 

  

mapView.Layers.Add(bufferLayer); 

Image1.ImageUrl = mapView.Draw().Url; 

    
Visual BasicCopy Code
' Create a filter And buffer To use With the the buffer layer

Dim layerFilter As New Filter("NAME = 'Mekong'")

Dim layerBuffer As New DisplayBuffer(100.0, BufferUnits.Kilometers)



' Create a renderer For the buffer--polygon Type since buffer Is a polygon

Dim bufferSymbol As _

    New SimpleFillSymbol(System.Drawing.Color.Yellow, _

    System.Drawing.Color.Yellow, PolygonFillType.FDiagonal)

Dim bufferRenderer As New SimpleRenderer(bufferSymbol)



' Create buffer layer from an existing layer

Dim originalLayer As FeatureLayer = _

    CType(mapView.Layers.FindByName("Rivers"), FeatureLayer)

Dim bufferLayer As FeatureLayer = _

    originalLayer.CreateBufferLayer(layerFilter, layerBuffer, _

    bufferRenderer, "riverBuffer")



mapView.Layers.Add(bufferLayer)

Image1.ImageUrl = mapView.Draw().Url

Remarks

Use this method to create a visual buffer around selected features in a layer.

If you need to select and highlight features within a buffer area, use CreateBufferSelectionLayer. A map can show both buffer and buffer selection layers. If you need to retrieve information about features found within a buffer, use Query(QueryParameters). If you need to select features by buffering around an arbitrary geometry object, use CreateSelectionLayer(Filter, Renderer, string), and set a Tolerance and Geometry for the Filter object.

The filter defines which features to buffer from. The buffer is drawn around these features. If no features are found with the filter, then no buffer will display.

To display the buffer, typically a SimpleRenderer is used for the renderer, and a SimpleFillSymbol is used with this renderer.

The ID must be unique among all layers in the map. Use any combination of alpha and numeric characters. Do not use spaces in the ID.

If used with ArcMap image services, the layer's Renderer must be set to null before drawing the map. Renderers cannot be used in selection or buffer layers for ArcMap image services. If a renderer is used, an error will be thrown. As an alternative, use the FeatureLayer(FeatureLayer) to construct a copy of the layer, then set the Filter, Buffer and ID of the new layer before adding it to the map's layer collection.

See Also

© 2010 All Rights Reserved.