Select to view content in your preferred language

How do I get layers' IDs using python?

9637
24
Jump to solution
01-04-2016 12:56 AM
DavidePavia
Deactivated User

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)
1 Solution

Accepted Solutions
FrédéricPRALLY
Esri Contributor

Davide,

Could you try to go back to the ZIP file you downloaded, select properties, then “unblock” the content?

Source

Fred

View solution in original post

24 Replies
DanPatterson_Retired
MVP Emeritus

Can show show a screen grab where you are toggling this on...I can't find one

0 Kudos
DavidePavia
Deactivated User

LayerID.jpg

I need to get this information from all of the layers in the .mxd from a python code..

Thank you Dan!

0 Kudos
DanPatterson_Retired
MVP Emeritus

Hmmmmmm

layer_id_issue.png

The only difference that I can see is that your layers have the red ! indicating that the layer can't be found.  In my example, all layers have a know path and that option doesn't exist.  Perhaps therein lies the difference.  Check to see whether, the ID check appears when a layer has a known path.

0 Kudos
DavidePavia
Deactivated User

The option appears because I've checked the box below in the data frame properties (even if the data source path is broken):

Immagine.jpg

I can see the layer's ID by opening their properties in the .mxd, but I don't know how to read them automatically in a python script..

0 Kudos
DanPatterson_Retired
MVP Emeritus

Now it is clear...small but important detail, and yes, I don't see any obvious way to get that from within arcpy layer properties

Addendum

for ArcGIS 10.3.1

Alphabetical list of arcpy.mapping classes—Help | ArcGIS for Desktop

Alphabetical list of arcpy.mapping functions—Help | ArcGIS for Desktop

lists the arcpy.mapping classes and functions in case others can see something

and for ArcGIS PRO

Alphabetical list of arcpy.mp classes—ArcPy | ArcGIS for Desktop

Alphabetical list of arcpy.mp functions—ArcPy | ArcGIS for Desktop

FrédéricPRALLY
Esri Contributor

Hi Davide,

Maybe you could use this geoprocessing tool: Get layer ID for a layer in ArcMap

Hope this help you,

Fred

DavidePavia
Deactivated User

Thank you very much Frédéric but is not working on my pc here is the screenshot and what happens when I run the installation..

Fred.jpg

I'm working with an advanced license of ArcGis 10.3.1

0 Kudos
FrédéricPRALLY
Esri Contributor

Hi Davide,

Do you execute the install on Windows 7 64-bit?

Could you run as adminitrator the install.bat?

So I have updated the tool. He splits it in 2 tools:

  • Get layer ID by layer

          (Add the ability to get layer ID for a specific layer. You can manipulate the output value in a python script for           example)

  • Get layer ID for all layers in mxd

Fred

0 Kudos
DavidePavia
Deactivated User

Yes, I've run the installation on Windows 64 as the administrator, still the same problem even with the new version you've uploaded..

0 Kudos