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:
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}")
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.
Here's how my parameter set up looks (only including the output's parameter for simplicity):
Label | Name | Data Type | Type | Direction | Description | Category | Filter | Dependency | Default | Environment | Symbology |
Final Output | final | Raster Dataset | Required | Output | | | | | | | |
Anyone know what I'm doing wrong?