script tool layer scope

3808
3
Jump to solution
02-19-2015 04:10 PM
BradBurford
New Contributor II

Is it possible to limit the scope of a script tool to a specified group layer? Otherwise, the tool takes 3 minutes + to load because it is looking at irrelevant layers.

Tags (4)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

Would it be quicker to move the layers out of the group layer into a new data frame temporarily (either manually or via code), then do the analysis?

View solution in original post

0 Kudos
3 Replies
ToddBlanchette
Occasional Contributor II

Hi Brad,

Can you be more specific on what you need the script tool to do? It sounds like you want to input certain layers only, which can be done by hard coding the values into Python, or using arcpy.GetParameterAsText to chose the input from the script GUI every time you run it. Unless I'm totally missing the mark here - in which case I need more info.

Cheers,

Todd

0 Kudos
DanPatterson_Retired
MVP Emeritus

Would it be quicker to move the layers out of the group layer into a new data frame temporarily (either manually or via code), then do the analysis?

0 Kudos
BradBurford
New Contributor II

The script tool is appending layers of the user's choice to existing SDE layers which are all in the same group layer. The layers to be appended are different every time the tool is used, so hard coding will not work.

Also, I am already using tool parameters to gather the input using arcpy.GetParametersAsText. The problem is that it takes an inordinately long time for the parameter dialog to load. It seems to be slow due to the total number of layers, most of which are irrelevant to the process.

I tried Dan's suggestion to use a New Data Frame. I copied the destination layers to the new data frame and the response time is much improved. I have tested this with dev data, and editing the same layers in two different data frames during the same editing session does not seem to have any adverse affect. Please advise if you know of any reason I should not do this.

I would still like to find a way to simply limit the tool dialog to a single, specific group layer. For now, however, I will copy the SDE layers to which I need to append data to a second data frame and just switch data frames for the append operation.

0 Kudos