Rajendra Yadav
Rajendra Yadav

Reputation: 635

How we add tile layer on arcgis map?

I am creating a arcgis widget using arcgis web app builder, now i m facing a problem to add tile layer on map.

 postCreate: function () {
          var this_object = this;
          this.graphicsLayerGSV = new GraphicsLayer();
          this.map.addLayer(this.graphicsLayerGSV);
          this.handlers = [];
          this.img = domConstruct.create("img", null, win.body(), "first");
          this.img.src = this.folderUrl + "images/flying_gsv_man_e.png";
          this.img.style.position = "absolute";
          this.inherited(arguments);
          onsole.clear();
          var socketURL = "ws://192.168.100.109:8082";//this.config.socketUrl;
          console.log('Websocket URL :: ' + this.config.socketUrl);

          var layover = new WebTiledLayer("http://dev.site.com/map/${level}/${row}/${col}.png");
          this.map.addLayer(layover);
          console.log(layover,'is working');

In above code this.map.addLayer(this.graphicsLayerGSV) is working but this.map.addLayer(layover) is not working.

Upvotes: 0

Views: 121

Answers (1)

T Kambi
T Kambi

Reputation: 1387

What error are you getting?

May be the layer has not loaded yet try this.

var layover = new WebTiledLayer("http://dev.alamatint.com/map/${level}/${row}/${col}.png");
if(layover.loaded){
    this.map.addLayer(layover);
} else {
    on(layover, "load", lang.hitch(this, function(){
        this.map.addLayer(layover);
    }
}

Ensure you have "dojo/on" and "dojo/_base/lang"

Upvotes: 0

Related Questions