I want the updated version of this code !! Anyone help kindly
Do you have an updated version of this code?
For both ArcGISDynamicMapServiceLayer and ArcGISTiledMapServiceLayer, there is a property call layerInfos which is LayerInfo[]. Each element of the array is a object of LayerInfo which has id, name etc properties. You can use it for your purpose. See Javascript API Reference for more detail.
I'm a real newbie and have a web app that embeds an ArcGIS map using the JavaScript API. I used the sample code from the following and have my app working:http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples/map_explicitlayerlist.htmlIf you visit the URL above, you'll see it uses layer ids for the default layers to be displayed (i.e., "imageParameters.layerIds = [2];" and "visible = [2];"). I currently have mine set to use layer ids, but I needed more than 1 layer displayed by default, so I currently have: "imageParameters.layerIds = [0,1,20,21,22];" and "visible = [0,1,20,21,22];".However, over time, the layer order will change because I'll be adding new layers. Therefore, I want to refer to the layers by name, instead of id.How do I modify the code at the sample URL above to set the default layers to display using layer names, instead of layer ids?Thanks,Steve
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.