Select to view content in your preferred language

How can I find out if the layer IDs are fixed in mxd through ArcObjects?

1141
1
03-02-2017 05:40 AM
RafaelDetoni
Deactivated User

I would like to know how can I find out if the layer IDs are fixed in mxd through ArcObjects? I usually use the code below to find the layer ids in mxd:

IMapDocument mapDocument = new MapDocumentClass();
mapDocument.Open("C:\\Temp\\MyProject.mxd");
IMap b = mapDocument.get_Map(0);
ILayerExtensions c = b.get_Layer(0) as ILayerExtensions;
IServerLayerExtension g = c.get_Extension(0) as IServerLayerExtension;

IPropertySet psN = new PropertySet();
psN.GetProperty("ServiceLayerID");

But when the ids are not fixed the returned Layer ID is wrong, because it follows the order of the layers included in the mxd.

By fixed ids i mean the configuration of Data Frame Properties General tab, when you check the box "Allow assignement of unique numeric IDs for map service publishing"

0 Kudos
1 Reply
MichaelWidmer
Emerging Contributor

Hi Rafael

Did you ever find a solution for this question? I'm currently struggling through the API documentation to find any a crumble of the mentioned information.

Cheers,
Michael

0 Kudos