Open GoogleCodeExporter opened 8 years ago
I get double layers as well in all instances. I'm loading public webmap and
doing this to populate:
var mapDeferred =
esri.arcgis.utils.createMap("16e7409c08bf4070ad2083b4a389fc14", "#id#map", {
mapOptions: {
slider: true,
nav:false
}
});
mapDeferred.addCallback(function(response) {
map = response.map;
var layers = response.itemInfo.itemData.operationalLayers;
var layerInfo = dojo.map(layers, function(layer,index){
return {layer:layer.layerObject,title:layer.title};
});
var toc = new agsjs.dijit.TOC({
map: map,
layerInfos: layerInfo
}, 'div');
});
what am i doing wrong?
Original comment by aaronkilbey@gmail.com
on 18 Jan 2012 at 6:57
The issue is that the proxy or is not being handled for the legend icons/images.
If you are using a proxy:
Update the following function ~ line 314 to this:
_getLegendIconUrl: function (legend) {
var src = legend.url;
// in some cases NULL value may cause #legend != #of renderer entry.
if (src != null && src.indexOf('data') == -1) {
if (!dojo.isIE && legend.imageData && legend.imageData.length > 0) {
src = "data:image/png;base64," + legend.imageData;
} else {
if (src.indexOf('http') !== 0) {
// resolve relative url
if (esri.config.defaults.io.proxyUrl != null) {
src = esri.config.defaults.io.proxyUrl + '?' + this.rootLayer.url + '/' + this.layer.id + '/images/' + src;
} else {
src = this.rootLayer.url + '/' + this.layer.id + '/images/' + src;
}
}
}
}
return src;
},
If you are using a token, then try the following in place of using
esri.config.defaults.io.proxyUrl (I have not tested):
src = this.rootLayer.url + '/' + this.layer.id + '/images/' + src +
?token=whateveryourtokenis;
Kori Maleski
Original comment by Kori.Mal...@gmail.com
on 22 Oct 2012 at 8:12
Hi,
I'm having the same problem.
I'm using a service with a token, I'm not using a proxy page because the app is
for mobile and I don't want to get a server just for the proxy page.
I tryed the suggestion but didn't worked.
Someone have any suggestion to correct this bug ?
William Caputo
Original comment by william....@gmail.com
on 9 Jan 2013 at 6:16
I was having the same problem and the above fix didn't work for me either. My
map only required me to add one dynamic layer meaning layerInfos only had one
element. For some reason the code seems to have trouble with this. I added an
additional element to layerInfos with a layer value of null and and a blank
string for the title and managed to get it to work. Example:
layerInfos: [{
layer: myDynamicLyr,
title: "Don't appear twice please"
},{
layer: null,
title: ""
}]
I'm sure there's a more elegant solution so I may look more closely at the TOC
code when I have a chance.
Original comment by AaronJCa...@gmail.com
on 23 Oct 2013 at 11:41
Original issue reported on code.google.com by
rubi.kar...@googlemail.com
on 27 Dec 2011 at 6:23Attachments: