This document is archived and information here might be outdated. Recommended version. |
The selection buffer distance. When drawing, and if a selection filter is specified, a buffer zone of the specified distance will be displayed around the selected features.
[Visual Basic .NET] Public Property SelectionBufferDistance As Double
[C#] public double SelectionBufferDistance {get; set;}
[C++]
HRESULT get_SelectionBufferDistance(
System.Double* Distance
);
[C++]
HRESULT put_SelectionBufferDistance(
double Distance
);
[C++]
Parameters Distance [out, retval]
Distance is a parameter of type double* Distance [in]
Distance is a parameter of type double
The selection buffer is based on Euclidian distance. The accuracy of the buffer is dependent on the spatial reference used in the map. An inappropriate spatial reference will result in inaccurate buffer distances. For best results, the map should be in an appropriate spatial reference.
In order to control the amount of information MapServer needs to process for a buffer, a maximum number of records to be buffered can be set. This value is contained in the MaxBufferCount property. The default value for this property is 100. If the number of features to be buffered exceeds MaxBufferCount no features will be buffered. The MaxBufferCount can also be changed by modifying the MaxRecordCount XML tag in the MapServer's configuration file.
The following sample code shows how to create a buffer around selected features. It assumes that you already have a valid MapServer and MapDescription object.
IMapServer mapServer;
IMapDescription mapDesc;
// Select all features in layer 0
string strMapName=mapDesc.Name;
int layerID=0;
IFIDSet FIDs=mapServer.QueryFeatureIDs(strMapName, layerID, null);
// Create buffer around selected feature
ILayerDescription layerDesc=mapDesc.LayerDescriptions.get_Element(layerID);
layerDesc.SelectionFeatures=FIDs;
layerDesc.SelectionBufferDistance=1; // map units
layerDesc.ShowSelectionBuffer=true;