<?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 Multipart color ramp for script tool raster output symbology with JSON in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/multipart-color-ramp-for-script-tool-raster-output/m-p/1622841#M74359</link>
    <description>&lt;P&gt;Hello, I'm trying to figure out how to properly set up a JSON string to get a multipart color ramp for the output (raster) symbology in a script tool. I've been looking all over the internet but can't find a working example specifically for getting a multipart color ramp. Here's what it looks like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if __name__ == "__main__":
    in_cdp = arcpy.GetParameterAsText(0)
    in_gdb = arcpy.GetParameterAsText(1)
    in_ocs = arcpy.GetParameterAsText(2)
    in_rff = arcpy.GetParameterAsText(3).split(";")
    in_srr = bool(arcpy.GetParameterAsText(4))
    final_out = arcpy.GetParameterAsText(5)

    main_process(in_cdp, in_gdb, in_ocs, in_rff, in_srr, final_out)

    # Output symbology
    json_str = '''{
        "type": "rasterStretch",
        "colorRamp": {
            "type": "multipart",
            "colorRamps": [
                {
                    "type": "algorithmic",
                    "fromColor": [56, 161, 208, 255],
                    "toColor": [241, 251, 124, 255],
                    "algorithm": "esriHSVAlgorithm"
                },
                {
                    "type": "algorithmic",
                    "fromColor": [241, 251, 124, 255],
                    "toColor": [239, 40, 32, 255],
                    "algorithm": "esriHSVAlgorithm"
                }
            ]
        }
    }'''

    arcpy.SetParameterSymbology(5, f"JSONRENDERER={json_str}")&lt;/LI-CODE&gt;&lt;P&gt;I've tried tweaking lots of things but every time I just still get the default black to white color ramp. I'm trying to mimic the "Prediction" color ramp available in the symbology pane when you set the symbology manually.&lt;/P&gt;&lt;P&gt;Here's how my parameter set up looks (only including the output's parameter for simplicity):&lt;/P&gt;&lt;TABLE width="924px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="63.3438px"&gt;Label&lt;/TD&gt;&lt;TD width="54.9531px"&gt;Name&lt;/TD&gt;&lt;TD width="66.0938px"&gt;Data Type&lt;/TD&gt;&lt;TD width="77.6562px"&gt;Type&lt;/TD&gt;&lt;TD width="77.4844px"&gt;Direction&lt;/TD&gt;&lt;TD width="94.5625px"&gt;Description&lt;/TD&gt;&lt;TD width="77.9531px"&gt;Category&lt;/TD&gt;&lt;TD width="47.4062px"&gt;Filter&lt;/TD&gt;&lt;TD width="104.578px"&gt;Dependency&lt;/TD&gt;&lt;TD width="63.5px"&gt;Default&lt;/TD&gt;&lt;TD width="103.188px"&gt;Environment&lt;/TD&gt;&lt;TD width="92.875px"&gt;Symbology&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="63.3438px"&gt;Final Output&lt;/TD&gt;&lt;TD width="54.9531px"&gt;final&lt;/TD&gt;&lt;TD width="66.0938px"&gt;Raster Dataset&lt;/TD&gt;&lt;TD width="77.6562px"&gt;Required&lt;/TD&gt;&lt;TD width="77.4844px"&gt;Output&lt;/TD&gt;&lt;TD width="94.5625px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="77.9531px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="47.4062px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="104.578px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="63.5px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="103.188px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="92.875px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Anyone know what I'm doing wrong?&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jun 2025 20:20:38 GMT</pubDate>
    <dc:creator>jrolson14</dc:creator>
    <dc:date>2025-06-11T20:20:38Z</dc:date>
    <item>
      <title>Multipart color ramp for script tool raster output symbology with JSON</title>
      <link>https://community.esri.com/t5/python-questions/multipart-color-ramp-for-script-tool-raster-output/m-p/1622841#M74359</link>
      <description>&lt;P&gt;Hello, I'm trying to figure out how to properly set up a JSON string to get a multipart color ramp for the output (raster) symbology in a script tool. I've been looking all over the internet but can't find a working example specifically for getting a multipart color ramp. Here's what it looks like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if __name__ == "__main__":
    in_cdp = arcpy.GetParameterAsText(0)
    in_gdb = arcpy.GetParameterAsText(1)
    in_ocs = arcpy.GetParameterAsText(2)
    in_rff = arcpy.GetParameterAsText(3).split(";")
    in_srr = bool(arcpy.GetParameterAsText(4))
    final_out = arcpy.GetParameterAsText(5)

    main_process(in_cdp, in_gdb, in_ocs, in_rff, in_srr, final_out)

    # Output symbology
    json_str = '''{
        "type": "rasterStretch",
        "colorRamp": {
            "type": "multipart",
            "colorRamps": [
                {
                    "type": "algorithmic",
                    "fromColor": [56, 161, 208, 255],
                    "toColor": [241, 251, 124, 255],
                    "algorithm": "esriHSVAlgorithm"
                },
                {
                    "type": "algorithmic",
                    "fromColor": [241, 251, 124, 255],
                    "toColor": [239, 40, 32, 255],
                    "algorithm": "esriHSVAlgorithm"
                }
            ]
        }
    }'''

    arcpy.SetParameterSymbology(5, f"JSONRENDERER={json_str}")&lt;/LI-CODE&gt;&lt;P&gt;I've tried tweaking lots of things but every time I just still get the default black to white color ramp. I'm trying to mimic the "Prediction" color ramp available in the symbology pane when you set the symbology manually.&lt;/P&gt;&lt;P&gt;Here's how my parameter set up looks (only including the output's parameter for simplicity):&lt;/P&gt;&lt;TABLE width="924px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="63.3438px"&gt;Label&lt;/TD&gt;&lt;TD width="54.9531px"&gt;Name&lt;/TD&gt;&lt;TD width="66.0938px"&gt;Data Type&lt;/TD&gt;&lt;TD width="77.6562px"&gt;Type&lt;/TD&gt;&lt;TD width="77.4844px"&gt;Direction&lt;/TD&gt;&lt;TD width="94.5625px"&gt;Description&lt;/TD&gt;&lt;TD width="77.9531px"&gt;Category&lt;/TD&gt;&lt;TD width="47.4062px"&gt;Filter&lt;/TD&gt;&lt;TD width="104.578px"&gt;Dependency&lt;/TD&gt;&lt;TD width="63.5px"&gt;Default&lt;/TD&gt;&lt;TD width="103.188px"&gt;Environment&lt;/TD&gt;&lt;TD width="92.875px"&gt;Symbology&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="63.3438px"&gt;Final Output&lt;/TD&gt;&lt;TD width="54.9531px"&gt;final&lt;/TD&gt;&lt;TD width="66.0938px"&gt;Raster Dataset&lt;/TD&gt;&lt;TD width="77.6562px"&gt;Required&lt;/TD&gt;&lt;TD width="77.4844px"&gt;Output&lt;/TD&gt;&lt;TD width="94.5625px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="77.9531px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="47.4062px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="104.578px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="63.5px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="103.188px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="92.875px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Anyone know what I'm doing wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 20:20:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multipart-color-ramp-for-script-tool-raster-output/m-p/1622841#M74359</guid>
      <dc:creator>jrolson14</dc:creator>
      <dc:date>2025-06-11T20:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Multipart color ramp for script tool raster output symbology with JSON</title>
      <link>https://community.esri.com/t5/python-questions/multipart-color-ramp-for-script-tool-raster-output/m-p/1623517#M74373</link>
      <description>&lt;P&gt;I think it's a formatting thing, Have you tried creating the symbology then saving it as a lyrx? You can either pass the path to that layer file as the symbology source, or copy and paste the parts you want into the json_str variable. The types key should be something like `CIMRaster...`&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 17:21:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multipart-color-ramp-for-script-tool-raster-output/m-p/1623517#M74373</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2025-06-13T17:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Multipart color ramp for script tool raster output symbology with JSON</title>
      <link>https://community.esri.com/t5/python-questions/multipart-color-ramp-for-script-tool-raster-output/m-p/1624748#M74395</link>
      <description>&lt;P&gt;Hi thanks for the reply! I prefer using the JSON method for the sake of portability (not having to make sure the user has the same .lyrx file). I tried copying the JSON from a lyrx file made from output of the tool set to the Prediction color ramp but still no luck and it seems like the symbology JSON in the lyrx is specific to that raster's values.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2025 17:07:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multipart-color-ramp-for-script-tool-raster-output/m-p/1624748#M74395</guid>
      <dc:creator>jrolson14</dc:creator>
      <dc:date>2025-06-18T17:07:51Z</dc:date>
    </item>
  </channel>
</rss>

