8

I am 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.

enter image description here

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.

  • 4
    The property DSID in arcpy.describe returns the ID of the data set. have you tried that? An example would be desc = arcpy.Describe("some layer") then desc.DSID – risail Jan 4 '16 at 13:44
  • What version of ArcGIS are you using? – crmackey Jan 4 '16 at 17:34
  • Hy Dan, the problem is that I need the ID of a layer, which doesn't seem to have the property "ID" accessible from with the describe function.. – Davide Pavia Jan 5 '16 at 14:51
  • I'm working with a 10.3.1 advanced version. – Davide Pavia Jan 5 '16 at 14:53
  • 2
    It's not about a particular layer or feature class, but something general. To turn on the ids check the option ("Allow assignment [...]") in the data frame's general tab. – Davide Pavia Jul 2 '16 at 8:47
1

After testing this in ArcGIS 10.3, and according to the documentation available for Layer and Describe in arcpy, and also this thread: https://geonet.esri.com/thread/178341, this functionality does not yet exist. You cannot access the layer ID from arcpy. You may be able to access it through ArcObjects if you have the knowledge.

As a workaround, can you enter the ID into the Credits or Description fields? You can access both of these fields through arcpy.

  • Goodmorning Jbalk, as you said I've written the Id layer in a table's field by using the Field Calculator tool (manually checking each layers' value). Thanks a lot for the advice, ArcObjects are my next stop.. – Davide Pavia Sep 22 '16 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.