From Pro SDK, I need to pass the rendering information to the JavaScript API. JavaScript API expects the renderer as a JSON. Is there any way to directly convert it to the JS API Compatible JSON. I tried serializing the CIMRenderer but the JS API expects it in a different format.
https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-SimpleRenderer.html
https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html
Examples of JS API Compatible renderer JSON:
Eg: Simple Renderer
{“type”: “simple”,
“symbol”: { "type": “point”,
"style": “circle”,
"color": [255,244,244,0.6], //rgba
"outline": { "width": 1, // in pixels
“color”: [255,140,0,0.5] //rgba
},
“size”: 4 // radius in pixels
}
}
Eg. Unique Value Renderer
{“type”: “uniqueValue”,
“field1”: “Asset”, //field in layer based on which features are rendered
“uniqueValueInfos”: [
{ “label”: “Car”,
“value”: “1”,
“symbol”: { "type": “point”,
"style": “circle”,
"color": [255,244,244,0.6],
"outline": { "width": 1,
“color”: [255,140,0,0.5]
},
“size”: 4 // radius in pixels
}
},
{ “label”: “Pool”,
“value”: “2”,
“symbol”: { "type": “point”,
"style": “circle”,
"color": [237, 81, 81, 1],
"outline": { "width": 0.75,
“color”: [153, 153, 153, 1]
},
“size”: 3
}
}