I created and published a feature service from ArcGIS Pro using advanced symbols (multilayer symbols with marker placement). I have two client applications consuming the same feature service:
Root Cause:
After investigating the REST endpoint, I discovered that the iOS SDK automatically appends ?returnAdvancedSymbols=true to the service requests, while the JavaScript SDK does not.
Current Workaround:
I can manually set the customParameters property on the layer:
const featureLayer = new FeatureLayer({
url: "https://your-server/arcgis/rest/services/YourService/FeatureServer/6",
customParameters: {
returnAdvancedSymbols: true
}
});https://codepen.io/eirikh/pen/zxrZepo?editors=1010
Questions:
Any guidance would be appreciated!
I will answer #2 up front - yes, you can enable this for all layers in your application. In order to do so, add the following before loading the SDK (e.g. in your codepen, I added it between lines 8 and 9):
<script type="text/javascript">
window.esriConfig = {
has: {
"featurelayer-advanced-symbols": true
}
};
</script>
Moving to #3, no, there's no official documentation I know of for this, including even the ability to add these flags (see also this post). As a result, I can't answer #1 either. As for #4, the best I can offer is to try it out and see what happens...
Thanks, @JoelBennett.
I have a related question if you have time: If one copies the "renderer" json output of the info endpoint when you call it with returnAdvancedSymbols=true, put that in your code and manually create a renderer of it using the Kotlin SDK like this, it works as expected:
val rendererJSON = JSONObject(...)
Renderer.fromJsonOrNull(rendererJSON.toString())?.let {
featureLayer.renderer = it
}
However, if you take that same output and try to create a Renderer using the generic Renderer.fromJSON using the JS SDK, it seems to expect a different input object and can't figure out the type automatically.
You seem to have to know that you have a UniqueValueRenderer using UniqueValueRenderer.fromJSON for it to work. Do you know a way for us to programmatically create a renderer from the json without having to manually check the "type" attribute ourselves to create a specific renderer?
Example:
https://codepen.io/eirikh/pen/NPxjBLr?editors=1010
You will likely get better results if you use the fromJSON method of the esri/renderers/support/jsonUtils module instead.