LayerDescription

Base Type: MapTableDescription

A class that describes the contents of a layer in a map service.

Property

Type

Description

DefinitionExpression

string

A where clause used to filter features for some query and display operations.

DrawingDescription

LayerDrawingDescription

Defines how a layer will be symbolized

LayerID

int

The unique id of the layer.

LayerResultOptions

LayerResultOptions

Defines if and how geometry is included in query results.

ScaleSymbols

bool

Indicates whether the layer should scale symbols according to a reference scale set in the default map (default map description).

SelectionBufferDistance

double

The buffer distance around selected features. It is defined in map units.

SelectionBufferSymbol

FillSymbol

The symbol of the buffer.

SelectionColor

Color

The color of selected features in a layer.

SelectionFeatures

int[]

An array of Feature IDs (FIDs) to render as selected features.

SelectionSymbol

Symbol

The symbol of selected features.

SetSelectionSymbol

bool

Indicates if should override default selection symbol.

ShowLabels

bool

If a layer has labels, define if they should be displayed in a map.

ShowSelectionBuffer

bool

If a selection buffer is defined (SelectionBufferDistance), show the buffer using the SelectionBufferSymbol.

Source

MapServerSourceDescription

Defines the data source for a dynamically added table or layer

SourceID

string

The id of results from a geoprocessing job (same as the job id). Used to define the source for a tool layer in a map service.

TimeDataCumulative

bool

Indicates if features will be animated cumulatively.

TimeDataCumulativeSpecified

bool

Indicates if TimeDataCumulative is specified.

TimeOffset

double

The time offset that needs to be applied to the data for drawing.

TimeOffsetSpecified

bool

Indicates if TimeOffset is specified.

TimeOffsetUnits

esriTimeUnits

The recommended time interval units to be used to animate this layer/ table.

TimeOffsetUnitsSpecified

bool

Indicates if TimeOffsetUnits is specified.

UseTime

bool

Indicates whether or not a layer should use the TimeSpan in the MapDescription to draw its contents.

UseTimeSpecified

bool

Indicates if UseTime is specified.

Visible

bool

Indicates if the layer is visible in a map.

Remarks

This object can be used to modify the presentation and use of a layer in a map. For example, you can use it to turn layers on/off when generating a map image or limit a query by applying a layer definition. These settings include a unique ID for the layer (LayerID), an ID the corresponds with a Geoprocessing job (SourceID), a boolean indicating if the layer is visible as defined in the table of contents, i.e. the layer is marked on (Visible), a boolean to indicate whether the layer should display its dynamic labels (ShowLabels) if labels for this layer are available to the map service, a boolean to indicate whether the layer should scale it symbols according to a reference scale set in the map (ScaleSymbols).

SourceID is used for map service interaction with the Geoprocessing server. It is a unique job id assigned to a geoprocessing service each time it runs on the server. This property can be used to find out which geoprocessing job has created this layer. It is important to note that LayerID, SourceID and the index of layers in map document are not the same.

In order for symbols to scale, the map must have a reference scale set and the layer must support symbol scaling. Use ScaleSymbols to activate or deactivate a layer's symbol scaling. If a map does not have a set reference scale setting, ScaleSymbols will have no effect. Use CanScaleSymbols on MapLayerInfo to verify if a layer supports symbol scaling. A reference scale is set within the original map document.

Not all map service layers have available labels. To see if the layer has labels use HasLabels on MapLayerInfo.

DefinitionExpression:

The LayerDescription includes a DefinitionExpression. A DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This only applies for the request and does not replace the definition query set in the source map.

When UseStandardizedQueries is True:

When UseStandardizedQueries is False:

Let's look at some examples. Queries mentioned in these examples can be used regardless of the value of UseStandardizedQueries.

You have a layer in your map that represents sales regions. The layer includes fields: REGIONS, SALES and MANAGER.

The following MapServer methods will honor DefinitionExpression: Find, Identify, QueryFeatureCount2, QueryFeatureIds2, QueryFeatureData2. The following map service methods will only use the definition expression set in the source map since a MapDescription or LayerDescription is not provided as a parameter: QueryFeatureCount, QueryFeatureIds, and QueryFeatureData. Note that DefinitionExpression does not affect spatial extents.

Please note that the following properties only honored in ExportMapImage and Identify operations:

Examples

C#

//Example #1: set a simple render to a layer (assuming you have variables i.e. pMapServer, pMapDescription, pLayerDescription and pImageDescription are referenced correctly)

//symbol for polygon outline
RgbColor pGreyColor = new RgbColor()
{
	Red = 110,
	Green = 110,
	Blue = 110
};

SimpleLineSymbol pOutline = new SimpleLineSymbol()
{
	Style = esriSimpleLineStyle.esriSLSSolid,
	Width = 1,
	Color = pGreyColor
};

//Solid fill symbol with red fill color
RgbColor pRedColor = new RgbColor();
pRedColor.Red = 255;

SimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbol()
{
	Style = esriSimpleFillStyle.esriSFSSolid,
	Color = pRedColor,
	Outline = pOutline
};

SimpleRenderer pSimpleRenderer = new SimpleRenderer();
pSimpleRenderer.Symbol = pSimpleFillSymbol;
pSimpleRenderer.Label = "Rivers";

//setting LayerDrawingDescription 
FeatureLayerDrawingDescription pFLDD = new FeatureLayerDrawingDescription();
pFLDD.FeatureRenderer = pSimpleRenderer;

pLayerDescription.DrawingDescription = pFLDD;
MapImage pMapImage = pMapServer.ExportMapImage(pMapDescription, pImageDescription);

//Example #2: changing only the DefaultSymbol for a layer (assuming you have variables i.e. pMapServer, pMapDescription, pLayerDescription, pImageDescription and strCurrentMapName are referenced correctly)

//symbol for polygon outline
RgbColor pGreyColor = new RgbColor()
{
	Red = 110,
	Green = 110,
	Blue = 110
};

SimpleLineSymbol pOutline = new SimpleLineSymbol()
{
	Style = esriSimpleLineStyle.esriSLSSolid,
	Width = 1,
	Color = pGreyColor
};

//Solid fill symbol with red fill color
RgbColor pRedColor = new RgbColor();
pRedColor.Red = 255;

SimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbol()
{
	Style = esriSimpleFillStyle.esriSFSSolid,
	Color = pRedColor,
	Outline = pOutline
};

//getting the default drawing description of the first layer
int[] pLyrIDs = new int[]{intLayerID};
LayerDrawingDescription[] pLDDs = pMapServer.GetDefaultLayerDrawingDescriptions(strDefaultMapName, pLyrIDs, null);
FeatureLayerDrawingDescription pFlyrDD = pLDDs[0] as FeatureLayerDrawingDescription;

//getting the renderer and changing the defaultSymbol to solid fill with red color
UniqueValueRenderer pUVR = pFlyrDD.FeatureRenderer as UniqueValueRenderer;
pUVR.DefaultSymbol = pSimpleFillSymbol;

//setting the renderer and changing the defaultSymbol to solid fill with red color
pLayerDescription.DrawingDescription = pFlyrDD;
MapImage pMapImage = pMapServer.ExportMapImage(pMapDescription, pImageDescription);

11/8/2016