Unable to fetch the Layer Names

483
0
11-06-2012 08:31 AM
SmaranHarihar
New Contributor III
I am trying to obtain the names of the individual layers in the MapService that I have hosted and populate it in the dijit.form.select. Now I have the mapservice url but is there some way I can obtain the layer names from them?

What I am trying to say is, I have one dijit.form.select which has the MXD names that I have provided in the list form,

<select name="Mxds" data-dojo-type="dijit.form.Select" id="ddMxd" data-dojo-props="onChange:function(){populateLayers(this.get('value'));}">
    <option value=0>Soil</option>
    <option value=1 selected="selected">Human Intervention</option>
    <option value=2>Climate</option>
  </select>


And On select change, I populate the other dijit.form.select like this,

var opts = [];
  for (var i = 0; i<ddArray[val].length; i++) {
   opts.push({label: ddArray[val].substring(54,ddArray[val].length-12), value: ddArray[val]});
  }
ddLyr = new dijit.form.Select({
   name: "selectLyr",
   options: opts
  }, dojo.byId('lyrs'));
  ddLyr.startup();
  dojo.connect(ddLyr, 'onChange', addLayer);
  }


Any Idea how I can achieve this? ddArray is an array which holds all the urls,
0 Kudos
0 Replies