AnsweredAssumed Answered

Add legend info for map layer

Question asked by mjk5000 on Nov 5, 2019
Latest reply on Nov 6, 2019 by LDanzinger-esristaff

I am creating a number of kml layers and adding them async to my map.  The problem is, is that I can't figure out how to create their legend info so that they can be displayed on my legend to the map.  I want to do something like this, but can't figure out how to get anything to work at all.  i know I need to add to the legendinfos of the layer or the map itself, but hit a roadblock.

 

This append below doesn't work at all, but shows what I am trying to do.

 

var newKMLLayer = ArcGISRuntimeEnvironment.createObject("KmlLayer",
                                                                {
                                                                    dataset: newKMLDataset,
                                                                    id: kmlLayer,
                                                                    description: inName,
                                                                    layerId: "LayerID",
                                                                    name: inName,
                                                                    maxScale: 0,
                                                                    minScale: 0,
                                                                    visible: false
                                                                });
newKMLLayer.legendInfos.append({
                                   "layerName": inName,
                                   "symbolURL": "URL"                                
                                  
                                })

        mapViewFieldSelected.map.operationalLayers.append(newKMLLayer)

Outcomes