我们如何在arcgis地图上添加图块层?

时间:2016-05-13 06:31:16

标签: dojo arcgis arcgis-server

我正在使用arcgis web app builder创建一个arcgis小部件,现在我遇到了在地图上添加切片图层的问题

 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');

在上面的代码 this.map.addLayer(this.graphicsLayerGSV)正在运作,但是 this.map.addLayer(停留)无效。

1 个答案:

答案 0 :(得分:0)

你得到什么错误?

可能是图层尚未加载但是试试这个。

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);
    }
}

确保您拥有“dojo / on”和“dojo / _base / lang”