How do I get layers' IDs using python?

8385
24
Jump to solution
01-04-2016 12:56 AM
DavidePavia
New Contributor II

Hello everyone and thanks in advance for the attention here is my problem..

..working in an ArcMap session, I've checked the option to get an ID for each of the layers in my document, so anyone has it.

Now, what I need is a way to get these values within a python script (to copy that automatically in a table): there's no such information in the layer's properties reached by a describe, nor from the .mapping module..

Thanks, and have a good day!

Davide 

Tags (2)
24 Replies
FrédéricPRALLY
Esri Contributor

Hi Davide,

I think I should recompile the tool under windows server 2012 R2 but I have not this OS at home. Sorry ...

Otherwise I modified the tool “Get layer ID for all layers in mxd” to managed group layer and multiple data frame on tool “Get layer ID for all layers in mxd”.

See gp result message :

Working on mxd E:\01_client\layerIDS.mxd

Dataframe: Layers01

LayerName | LayerID

prefecture | 10

departements | 33

New Group Layer | 35

     dep1 | 36

     Sub Group Layer | 39

           dep3 | 36

           dep4 | 37

     dep2 | 37

Dataframe: Layers02

LayerName | LayerID

prefecture | 2

departements | 1

New Group Layer | 0

     dep1 | 5

     dep2 | 6

Fred

0 Kudos
DavidePavia
New Contributor II

Good afternoon Frédéric,

could I please contact you privately?

I've tried to send a private message here in Geonet, but I guess that we need to be "Friend"..

Thank you very much, have a good evening

Davide

0 Kudos
DavidePavia
New Contributor II

Dan, as you'll read below I succeed in the installation by unlocking the .zip file as Fred told thank you anyway for the precious help!!

TobiasFimpel
Occasional Contributor

 Davidepaviaarcgis, fprallyesrifrance-fr-esridist, and others: do you know if any alternatives have been made available by Esri or others since this thread started? I am hoping to run this on a more recent Windows OS and more recent version of ArcMap. Thank you.

0 Kudos
RichardHartley2
New Contributor

I managed to run the "Get layer ID for all layers in mxd" tool using ArcMap 10.5.1 on Windows 10 using ModelBuilder (as described in the tool documentation). However, it does not seem to run when running the tool from ArcCatalog, as I receive 'ERROR 000816: The tool is not valid'.

0 Kudos