How can I manipulate the TOC display name of my output parameters when using a Python toolbox (.pyt) Tool class. I tried adding a symbology layer, however this has no affect on the TOC name. Is it possible to reference the layer(s) added as output from the execute method of a tool. The expected results are added to map and TOC, but I can't figure out how to manipulate the TOC display name. I could loop through the layers in the TOC after exectution and check each layers datasource, but this seems problematic. I've searched the help and applied the extent of my Google Foo.
In my tool class I define my parameters as follows:
def getParameterInfo(self): extent = arcpy.Parameter( displayName='Analysis Extent', name='extent_features' , datatype='GPFeatureLayer', parameterType='Required' , direction='Input') extent.filter.list = ['Polygon', ] tilelayer = arcpy.Parameter( displayName='Analysis Tiles', name='tile_layer' , datatype='GPFeatureLayer', parameterType='Required' , direction='Output') tilelayer.symbology = os.path.join(os.path.dirname(__file__), 'pyltk/analysis_tiles.lyr')
Follow Up: This normally would not be a problem as the output would reflect the name of the feature class. However, I've been evaluating the use of the new SQLite workspace for integration with external libraries, etc. ArcGIS prepends the internal SQLite database name 'main' to all my feature classes and tables. When ArcPy adds the results to the map it only adds the database name, and not the whole name. For instance if the output feature class is called "..\analysis_tiles" ArcGIS will refer to this as "..\main.analysis_tiles", but the resulting TOC name is just "main".