snaperski

WebTiledLayer in BasemapGallery

Discussion created by snaperski on Oct 20, 2013
Latest reply on Jul 11, 2016 by kwells_1
Hello!

My intention is to add custom basemaps (WebTiledLayer) to BasemapGallery, without ArcGISBasemaps, in the following way:

  
                        var bm1 = BasemapLayer({type: "WebTiledLayer",url:"http://tiles.maaamet.ee/tm/s/1.0.0/kaart/${level}/${col}/${row}.png"});
   var bm2 = BasemapLayer({type: "WebTiledLayer",url:"http://tiles.maaamet.ee/tm/s/1.0.0/hybriid/${level}/${col}/${row}.png"});
   var akaart = new Basemap({
    layers: [ bm1, bm2 ],
    id: "test1",
     title: "MAMT aluskaart 1 "
   });

   var hkaart = new Basemap({
    layers: [ bm2 ],
    id: "test2",
     title: "MAMT aluskaart 2"
   });
   
   basemaps = [akaart, hkaart];

          basemapDijit = new BasemapGallery({
     basemaps: basemaps,
     showArcGISBasemaps: false,
     //basemapsGroup: basemapGroup,
     map: _self.options.map
    },domConstruct.create("div"));


Somehow it is not possible and digging deeper into ArcGIS JSAPI I found that the the function _switchBasemapLayers outputs:
"esri.dijit.BasemapGallery: Unable to switch basemap because new basemap is a tiled service and cannot be loaded as a dynamic layer." (this.map.getNumLevels() returns 0).

Yet the API (https://developers.arcgis.com/en/javascript/jsapi/basemaplayer.html) says that it's possible to add WebTiledLayer as a BasemapLayer and hence I assume it's possible to add as a Basemap to BasemapGallery.

What's the problem here? I would appreciate any help.


Thank you,
Raivo Alla
Estonian Land Board

Outcomes