Add dynamically Esri Gis layres

Hello,
I'm trying to add dynamically layers to Esri Gis imagery provider.
I initialize the imagery provider like that:

var esri = new Cesium.ArcGisMapServerImageryProvider({
    url : ‘https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer’,
    layers: ‘0,1’
});

And I want to add more layers in run-time, something like:

esri.layers = esri.layers + '3,4';

But it doesn't work.

Please help,
Thank you

Hi,
I am no expert, just a learner myself - but looking at: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/ArcGisMapServerImageryProvider.js#L544, that is a readonly property.

instead your option could be to remove and re-add (https://cesiumjs.org/Cesium/Build/Documentation/ImageryLayerCollection.html) the same - sandcastle example: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=tVPRbtowFP0VixdAyhwiQLSMoqF2apG6dWqq9SVS5TqXYOHYke2kYhP/vusY0KDbwx6Wp+T63HPPOb5pmCGNgDcw5IooeCPXYEVd0u9trdfl7ee1Vo4JBabb/5ipTMUxWeQ5YYosDL9dpuQLq1IwDbKIkhVgtkSyLZhMNexYuvcVi2PCPHpSbmk9GKwRp1L8CGGPE5ah7ZvRjchR4s9MEXxqI8mUdNfOVXYaxxaxAsVTZnghrFYS5VOuyzgojg1Yd0TFz9rI/GVPHR9ndaNA3pqxSD+Ikm6mdj6FE/mU5fm5MO/EAzGs1DHjiF6tiNR6I1RBmCOL2jrDpGAUnYdIOCvBMGrB+fwP1nKUKhRzQqvpIZRH4I6pQgJdGV3eQGEAbC9JRnR8mUTkw2hML4aTiCSjC3o5GWBlTCfDQX8vPmS9ZiqX5zefcqRSacU4fG5AubsA6h0lYqs9roERxdoRLgXfEKcJR8oCQl4Ufe0neEdLVdVuwb2L3qpW4aXUDZQ4pE/2Xk9TNeABCynbMCPiTA1+9HvkH/L/5xX672t0vkrRMBp1w9Gu733tor/dwtO2Avq4vL17erl5eP4a8u9EnZl1WwnzQPJJlJXGRUMTPUpjB2UlmUNdrzXfgKPcthc3iw9Ns1w0RORXWefsP886eKfMWjxZ1VKm4gdknfksRvxJm9Qsx3V+QJNozEPWyfw+FCmlsxg/33c5reUrM78x/gI

again, like I said - I am just learning too..

thanks.

Hi,

See my response here for an answer to the same question. We have Issue #6563 open to track the request, I’ll also mention your request here.

Thanks,

Gabby

Thank you!
I will wait for that feature and in the meanwhile use the workaround