Select to view content in your preferred language

JavaScript SDK not rendering advanced/multilayer symbols by default - returnAdvancedSymbols parameter

255
3
10-08-2025 02:23 AM
EndreStoksethGeodata
Emerging Contributor

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:

  • iOS client (ArcGIS Maps SDK for Swift): Renders the advanced symbols correctly as expected
  • Web client (ArcGIS Maps SDK for JavaScript): Renders only simple symbols, missing the multilayer symbol details

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:

  1. Why does the JavaScript SDK default to returnAdvancedSymbols=false while the Swift SDK defaults to true?
  2. Is there a global configuration option to enable advanced symbols by default for all layers in the JavaScript SDK?
  3. Is this behavior documented anywhere? I couldn't find any mention of returnAdvancedSymbols in the JavaScript SDK documentation.
  4. Are there performance implications I should be aware of when enabling advanced symbols for web clients?

Any guidance would be appreciated! 

3 Replies
JoelBennett
MVP Regular Contributor

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...

EirikH
by
Regular Contributor

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

0 Kudos
JoelBennett
MVP Regular Contributor

You will likely get better results if you use the fromJSON method of the esri/renderers/support/jsonUtils module instead.