This document is archived and information here might be outdated. Recommended version. |
The layer ID. This is a unique ID for the layer, and is used to identify the layer in a number of method calls.
[Visual Basic .NET] Public Property ID As Integer
[C#] public int ID {get; set;}
[C++]
HRESULT get_ID(
System.Int32* LayerID
);
[C++]
HRESULT put_ID(
long LayerID
);
[C++]
Parameters LayerID [out, retval]
LayerID is a parameter of type long* LayerID [in]
LayerID is a parameter of type long
ID is a unique identifier for a layer in a given instance of ArcGIS for Server map service. It is important to note that ID, SourceID and the index of layers (see MapLayerInfos) in map document are not the same. SourceID is used for map service interaction with the GPServer.
When a map service is published, a unique ID is assigned to all layers within the original map document (.mxd) starting from 0 (zero). This ID is accessible from IMapServerObjects2, MapLayerInfo, LayerDescription, MapServerLegendInfo, MapServerIdentifyResult, MapServerFindResult and FeatureExtent.
ID is not re-usable and does not change if the order of the layer is changed. This would change the how each layer is ordered in the index of layers. Adding new a layer results in a new ID being assigned. IDs keep incrementing as new layers are added to the map service. The limit of id numbers available is the limit of Long data type.
Please note that if the layer order in the TOC of the original map is changed or if layers are added/removed, the IDs will change accordingly.