AnsweredAssumed Answered

Uncaught TypeError: this.map.getLayer is not a function

Question asked by rolandoflorez17 on Nov 25, 2016
Latest reply on Nov 25, 2016 by rscheitlin

Hi, I need some of help

this is my code:

_reportLayerInfo : function () {
   console.warn('reportLayerInfo');
   console.log(this.allLayerInfos);
   var filteredArr = array.filter(this.allLayerInfos, function (item) {
      return item.getSubLayers().length == 0;
   });
   console.warn('filtered layers infos');
   console.log(filteredArr);
   array.forEach(filteredArr,function(layer){
      console.log(lang.hitch(this,this.map.getLayer(layer.id)));
   });
}

(sorry, I dont known how put a code block)

So, _reportLayerInfo() method is activate when I clic a button, now, when I clic the button, the console shows me that error: Uncaught TypeError: this.map.getLayer is not a function.

As you can see, I used the lang.hitch because I thought that It was the solution.

 

Thanks a lot.

Outcomes