GP Tool SL Builder - User-drawn selection poly FeatureSet persists when tool closed

11-25-2013 12:30 PM
New Contributor III
I have a published GP script which was written in a Python Toolbox and results were published as GP Service in ArcMap.

My script is simple - User draws a polygon to select features in a point layer.  User-defined selection polygon is set as an input parameter, type FeatureSet, schema set to polygon shapefile.  The selected feature attributes are exported to a CSV file for the user.  The GP Task itself works exactly as expected.

Problem:  The graphic created in the Silverlight Builder app when the user draws a selection polygon persists on the screen and is added as a new layer to the Map Contents window in the Silverlight Builder.  These will not go away until you close the app and reopen.  This is not expected behavior. 

Here is what I have already tried:

1.  Set Geoprocessing Options in ArcMap before I run the tool and publish the results.
[INDENT]Add results of geoprocessing operations to the display is turned OFF.  In ArcMap the selection poly never appears in the TOC.[/INDENT]
[INDENT]Results are temporary by default is ON, but result is the same if it is turned off.[/INDENT]

2.  arcpy.addOutputsToMap=False is set in my Python code.

3.  Every feature layer, feature set parameter, anything temp in the code is deleted in Python with arcpy.Delete_management at the end of the script.

I'm confused as to why the graphic and the layer in the Map Contents window don't disappear when the tool is closed.  In addition, if you run the tool again you will get a second persistent graphic, and a second layer added to the Map Contents window, and so on as many times as you want to run the tool.

There appears to be no option in the GP task configuration in the SL Builder to add or not add the user-defined poly to the Map Contents window.

I do not have the option to fool with the back-end Silverlight code, this all has to be managed through the GP task with Python.

Any ideas what I might be doing wrong?  Picture of SL Builder attached to show the multiple graphics and added map layers.

0 Kudos
0 Replies