bbehling / gmaps-utility-gis

Automatically exported from code.google.com/p/gmaps-utility-gis
0 stars 0 forks source link

Double layers listed in TOC #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am using ArcGIS Server 10 with JavaScript API 2.6.  I am using SSL.

What steps will reproduce the problem?
1. Without token, every thing is fine.
2. As I add token (after security enable in ArcGIS Server), the  
   layers in TOC repeats and ledgent is lost
3.

What is the expected output? What do you see instead?

I want single set of layers displayed in TOC not repeated twice.  Works fine 
with out token

What version of the product are you using? On what operating system?

Windows 2008 server (64 bit) (production)
Windows 7 PC (32bit) (Test) -- problem here so not loaded to server yet

Please provide any additional information below.

Original issue reported on code.google.com by rubi.kar...@googlemail.com on 27 Dec 2011 at 6:23

Attachments:

GoogleCodeExporter commented 9 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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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