How to utilize a Layer's selectability in Python code?

3940
6
03-03-2015 08:25 AM
DavidGranata
New Contributor II


Currently the interactive ArcMap GUI allows setting a layers selectability.  Interactively tool processing is based on a layer's selectability.  Is there a way to use "selectability" in Python?  I understand that in ArcObjects there is a way.  Has anyone create a callable "module" or have a workaround where "selectability" can be determined in Python code?

0 Kudos
6 Replies
XanderBakker
Esri Esteemed Contributor

It is not exposed through arcpy...  but you could use ArcObjects through Python. Some more pointers can be found here: ArcObjects in Python

0 Kudos
DavidGranata
New Contributor II

Hi Xander,

I am new to Python and have no experience with ArcObjects.  Do you know if there is a module already created that can be downloaded and (hopefully) simply called from Python?

I am not in a position to create an ArcObject subroutine to call.

Thank you.

0 Kudos
XanderBakker
Esri Esteemed Contributor

If you are new to Python and have no experience with ArcObjects, then this will be a huge challenge...

Maybe you can elaborate a little on what you would like to do with the "selectability"  of a layer. There might be other possibilities that don't require the use of ArcObjects...

Useful resources for learning Python and Arcpy

Suggestions are made for learning Python:

Seeking advice on how to go about learning Python

Learning Python

You can also have a look at my blog Some Python Snippets

In case you know Python and want to learn arcpy, then the Help is a very values resource: ArcGIS Help (10.2, 10.2.1, and 10.2.2)

And also these posts are worth mentioning:

python - What are some resources for learning ArcPy? - Geographic Information Systems Stack Exchange

Seven easy ways to start learning Python and ArcPy | Support Services Blog  (point 6 and 7)

0 Kudos
DavidGranata
New Contributor II


Xander,

I am new to Python and Arpy.  We have ArcMap version 10.1.  I am using it to create ArcMap tools to increase efficiency for staff.  I work for a local jurisdiction (City).

Details to what I am doing.  Creating a tool to process an MXD containing our utility layers and other background map layers.  Some of the utility layers contain a data field with the Construction Plan (Asbuilt) PDF file name which created it.  Public requests for information have been manually processed to select the area of interest and dump the project names and copy the files to media for delivery.  Time consuming.

I have created a Python Script Tool to do this process with user interaction, inputs.  To make the tool flexible and not hardcoded, I was counting on using the layers "Selectability", as the interactive interface allows, to indicate what layers to be processed.  The user would be able to make a utility "Unselectable" to drop it from the processing depending on the publics request parameters.  Manually that is how it works; selectable layers are processed, unselectable are not.

I hope this gives a clearer understanding of what I am trying to accomplish.

The workaround I am using is making the user move the layer to a "Group" titled "Do Not Process Layer".  Where this is not as user friendly is one user makes the modification to the MXD and the next user may not realize a layer is in that group.  In the interactive interface, layer selectability, is user friendly for this distinction.

0 Kudos
XanderBakker
Esri Esteemed Contributor

The closest thing to the selectability of a layer would be the "visible" property of the layer, although that has a direct influence on what the user will see on screen. Maybe include a multi select list of strings (layer names) in which the user can select and unselect a layer for processing.

0 Kudos
DavidGranata
New Contributor II

Thank you for the information and learning!

0 Kudos