WebTiledLayer in BasemapGallery

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

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

                        var bm1 = BasemapLayer({type: "WebTiledLayer",url:"${level}/${col}/${row}.png"});
   var bm2 = BasemapLayer({type: "WebTiledLayer",url:"${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,

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." ( returns 0).

Yet the API ( 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