<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to display feature layer from Python Toolbox? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-display-feature-layer-from-python-toolbox/m-p/1249701#M64431</link>
    <description>&lt;P&gt;Try adding a derived output parameter to your tool, then using the "SetParameter" or "SetParameterAsText" function in your script to put the output features into that parameter. Tools don't output data unless they have an output parameter configured.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Also for the future, what you're writing is a script tool in a normal toolbox, a Python toolbox is a different beast entirely.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 21:00:53 GMT</pubDate>
    <dc:creator>DavidSolari</dc:creator>
    <dc:date>2023-01-19T21:00:53Z</dc:date>
    <item>
      <title>How to display feature layer from Python Toolbox?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-display-feature-layer-from-python-toolbox/m-p/1249618#M64414</link>
      <description>&lt;P&gt;I have a Search Cursor that operates at the end of the model. It works as intended but does not add the layer it ends up creating to the Map. I've tried connecting it to the "Collect Values" tool with Paramaters and Display selected, and it still won't work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Paramaters.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60766i6202ADD32D882185/image-size/large?v=v2&amp;amp;px=999" role="button" title="Paramaters.png" alt="Paramaters.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here's the script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import os
import sys
import arcpy
Filter_Layer = arcpy.GetParameterAsText(0) # Feature Layer
Search_Layer = arcpy.GetParameterAsText(1) # Feature Layer
Workspace = arcpy.GetParameterAsText(2) # Workspace

FP1 = os.path.abspath(Workspace)
events = arcpy.da.SearchCursor(Filter_Layer, ['Event'])
unique_events = list(set([row[0] for row in events]))
sql = "Event IN(" + ','.join(map(str, unique_events)) + ")"
arcpy.management.SelectLayerByAttribute(Search_Layer, "NEW_SELECTION", sql, None)
arcpy.management.CopyFeatures(Search_Layer, fr"{FP1}\RTL_Filtered", '', None, None, None)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 18:41:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-display-feature-layer-from-python-toolbox/m-p/1249618#M64414</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-01-19T18:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to display feature layer from Python Toolbox?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-display-feature-layer-from-python-toolbox/m-p/1249701#M64431</link>
      <description>&lt;P&gt;Try adding a derived output parameter to your tool, then using the "SetParameter" or "SetParameterAsText" function in your script to put the output features into that parameter. Tools don't output data unless they have an output parameter configured.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Also for the future, what you're writing is a script tool in a normal toolbox, a Python toolbox is a different beast entirely.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 21:00:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-display-feature-layer-from-python-toolbox/m-p/1249701#M64431</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2023-01-19T21:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to display feature layer from Python Toolbox?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-display-feature-layer-from-python-toolbox/m-p/1249863#M64453</link>
      <description>&lt;P&gt;It worked thank you!&lt;/P&gt;&lt;P&gt;Added a new paramater (output) and then,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.SetParameterAsText(3, outputFile)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;mport os
import sys
import arcpy
Filter_Layer = arcpy.GetParameterAsText(0) # Feature Layer
Search_Layer = arcpy.GetParameterAsText(1) # Feature Layer
Workspace = arcpy.GetParameterAsText(2) # Workspace
FP1 = os.path.abspath(Workspace)
outputFile =  fr"{FP1}\RTL_Filtered"

events = arcpy.da.SearchCursor(Filter_Layer, ['Event'])
unique_events = list(set([row[0] for row in events]))
sql = "Event IN(" + ','.join(map(str, unique_events)) + ")"
arcpy.management.SelectLayerByAttribute(Search_Layer, "NEW_SELECTION", sql, None)
arcpy.management.CopyFeatures(Search_Layer, fr"{FP1}\RTL_Filtered", '', None, None, None)

arcpy.SetParameterAsText(3, outputFile)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 13:28:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-display-feature-layer-from-python-toolbox/m-p/1249863#M64453</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-01-20T13:28:46Z</dc:date>
    </item>
  </channel>
</rss>

