AnsweredAssumed Answered

About adding layers to LayerList

Question asked by endlessdsire on Oct 11, 2017
Latest reply on Aug 22, 2018 by endlessdsire

Hello there.


Im a little bit confused on how is the way to add layers into a LayerList obj. Im using Arcgis Api  3.17.

My code is the following:


var mapp = mymap.createMap("map","topo",-71.5215, -32.9934,9);

var interrClienteSED = new ArcGISDynamicMapServiceLayer(layers.read_dyn_layerClieSED(),{id:"po_interrupciones"});
3: {infoTemplate: myinfotemplate.getNisInfo()},
1: {infoTemplate: myinfotemplate.getIsolatedNisFailure()},
0: {infoTemplate: myinfotemplate.getSubFailure()}
interrClienteSED.refreshInterval = 1;

var chqmapabase = new ArcGISDynamicMapServiceLayer(layers.read_mapabase(),{id:"gis_chqmapabase"});
var heatmapFeatureLayerOptions = {
id: "gis_heatmapsed",
mode: FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"]
var heatmapFeatureLayerOptions2 = {
id: "gis_heatmapclientes",
mode: FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"]
var heatmapFeatureLayer = new FeatureLayer(layers.read_heatmapSED(), heatmapFeatureLayerOptions);
var heatmapFeatureLayer1 = new FeatureLayer(layers.read_heatmapClientes(), heatmapFeatureLayerOptions2);
var heatmapRenderer = new HeatmapRenderer({
colors: ["rgba(0,255,0, 0)","rgb(255, 255, 0)","rgb(255, 0, 0)"],
blurRadius: 16,
maxPixelIntensity: 250,
minPixelIntensity: 5
var gpsCars = new ArcGISDynamicMapServiceLayer(layers.read_GPS(), {id:"gis_gps"});
0: {infoTemplate: myinfotemplate.getCarsInfo()}
gpsCars.refreshInterval = 0.1;
var gpsNew = new ArcGISDynamicMapServiceLayer(layers.read_gps_new(), {id:"gis_gps_new"});

mapp.addLayers([chqmapabase,interrClienteSED, heatmapFeatureLayer, heatmapFeatureLayer1, gpsCars]);
var layerList = new LayerList({
map: mapp,
showLegend: true,
showSubLayers: true,
showOpacitySlider: true,
layers: [interrClienteSED, gpsCars]



Then i have only this in my html:


<div className="map_container">
    <div id="layerlist"></div>
    <div id="map"></div>
    <Simbology />


The result i have is this one:


I was trying with the layers that i already have added in the map, but actually i want to use another service where i have sublayers according this structure:

Layers :
 One (0)

   • One - 1 (1)

Two (3)
   • Two - 2 (4)


I want to see in the layerlist all of them, see the legend and turn on/off each one.


Thanks in advice!.