<?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: Python Geoprocessing Service return output features (GPFeatureRecordSetLayer?) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1194789#M65049</link>
    <description>&lt;P&gt;Publishing worked after restart of ArcGIS Pro.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jul 2022 05:57:22 GMT</pubDate>
    <dc:creator>RichardReinicke</dc:creator>
    <dc:date>2022-07-22T05:57:22Z</dc:date>
    <item>
      <title>Python Geoprocessing Service return output features (GPFeatureRecordSetLayer?)</title>
      <link>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1192882#M65004</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I actually want to create a Geoprocessing Service published from a Python Toolbox and ArcGIS Pro 2.8.3.&lt;/P&gt;&lt;P&gt;From a third party service I get geojson in my server-side process which I can transform into esri json or Features / FeatureLayer. But from there, how do I provide these features as output of my geoprocessing service? What kind of output data format do I have to use?&lt;BR /&gt;&lt;BR /&gt;Docu says the server only supports a few data formats like&amp;nbsp;GPFeatureRecordSetLayer which expects a special json input. But how can I automatically get such a json from my features?&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        search_results = arcpy.Parameter(
            displayName="Search Results",
            name="search_results",
            datatype="GPFeatureRecordSetLayer",
            parameterType="Derived",
            direction="Output")&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;&lt;P&gt;Esri Json doesn't seem to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;esri_search_data = r"{0}\search_data.json".format(arcpy.env.scratchFolder)
arcpy.FeaturesToJSON_conversion(search_data_path, esri_search_data)
esri_data = self.read_textfile(esri_search_data)
parameters[1].value = esri_data&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;&lt;P&gt;As a result the client should create a feature layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My geoprocessing service should be used mainly by ArcGIS Pro clients. Optionally it would be great if the output could be used by esri web clients as well like Esri JS API.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Does anybody know how this can be achieved?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 13:18:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1192882#M65004</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2022-07-18T13:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Python Geoprocessing Service return output features (GPFeatureRecordSetLayer?)</title>
      <link>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1193904#M65025</link>
      <description>&lt;P&gt;Nobody an idea? No one using Python geoprocessing services that return features to clients like ArcGIS Pro? From my understanding this should be a common task.&lt;/P&gt;&lt;P&gt;My process successfully creates a feature class from my third party data but I'm still unable to return this feature class in a way from my service, so that clients like ArcGIS Pro add them as a new layer to the active map.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;search_results = arcpy.Parameter(
            displayName="Search Results",
            name="search_results",
            datatype="GPFeatureRecordSetLayer",
            parameterType="Derived",
            direction="Output")

srs_etrs89 = arcpy.SpatialReference(25832)
search_fc = arcpy.CreateFeatureclass_management(scratch_db_path, 
    "search_results", "POLYGON",
    "", "DISABLED", "DISABLED", srs_etrs89)

fields = ['text', 'typ', 'score', 'bbox'] # Only use common bkg fields
search_results_cursor = None

for index, feature in enumerate(result_features, start=0):
    if index == 0:
        for field in fields:
            arcpy.AddField_management(search_fc, field, "TEXT")
            fields.append('SHAPE@')
            search_results_cursor = arcpy.da.InsertCursor(search_fc, fields)
    self.write_feature_row(search_results_cursor, feature, srs_etrs89)

del search_results_cursor
parameters[1].value = search_fc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 13:26:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1193904#M65025</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2022-07-20T13:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: Python Geoprocessing Service return output features (GPFeatureRecordSetLayer?)</title>
      <link>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1193926#M65026</link>
      <description>&lt;P&gt;With GPFeatureLayer as outpt datatype my ArcGIS Pro adds the local processing result as a new layer.&lt;/P&gt;&lt;P&gt;But for some reason that I don't know (are there logs, console, anything???) I'm not able to publish my tool to the server. ANLYZE and PUBLISH buttons are disabled without any hint whats wrong. Again my tool runs successfully in ArcGIS Pro. Pls Esri help the developer a little bit.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RichardReinicke_0-1658325407933.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/46277i441BF7446BDB36E8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RichardReinicke_0-1658325407933.png" alt="RichardReinicke_0-1658325407933.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 13:57:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1193926#M65026</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2022-07-20T13:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python Geoprocessing Service return output features (GPFeatureRecordSetLayer?)</title>
      <link>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1194789#M65049</link>
      <description>&lt;P&gt;Publishing worked after restart of ArcGIS Pro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 05:57:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-geoprocessing-service-return-output/m-p/1194789#M65049</guid>
      <dc:creator>RichardReinicke</dc:creator>
      <dc:date>2022-07-22T05:57:22Z</dc:date>
    </item>
  </channel>
</rss>

