AnsweredAssumed Answered

Add OpenStreetMap to basemapgallery - manually

Question asked by davidraijmakers on Dec 17, 2012
Latest reply on Dec 17, 2012 by davidraijmakers
I dont know how to add the OpenStreetMap to the basemapgallery. I want to do this manually because when i use ShowARCGIS basemaps:true i get too many basemaps i dont use.

Here's my code:

function createBasemapGallery() {
        //add the basemap gallery, in this case we'll display maps from ArcGIS.com including bing maps
        var basemapGallery = new esri.dijit.BasemapGallery({
          showArcGISBasemaps: false,
          bingMapsKey: 'BINGKEY',
          map: map
        }, "basemapGallery");

var basemapRoad = new esri.dijit.Basemap({
          layers: [new esri.dijit.BasemapLayer({
            type: "BingMapsRoad"
          })],
          id: "bmRoad",
          title: "Bing Maps Wegen",
      thumbnailUrl:"images/basemap_streets.jpg"

        });
        basemapGallery.add(basemapRoad);
        var basemapAerial = new esri.dijit.Basemap({
          layers: [new esri.dijit.BasemapLayer({
            type: "BingMapsAerial"
          })],
          id: "bmAerial",
          title: "Bing Maps Luchtbeelden",
      thumbnailUrl:"images/basemap_imagery.jpg"

        });
       basemapGallery.add(basemapAerial);
        var basemapHybrid = new esri.dijit.Basemap({
          layers: [new esri.dijit.BasemapLayer({
            type: "BingMapsHybrid"
          })],
          id: "bmHybrid",
          title: "Bing Maps Hybride",
      thumbnailUrl:"images/basemap_imagery_with_labels.png"

        });
        basemapGallery.add(basemapHybrid);



var layer5 = new esri.dijit.BasemapLayer({
  url:"http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"
});
var basemap5 = new esri.dijit.Basemap({
  layers:[layer5],
  title:"Lichtgrijs Canvas",
  thumbnailUrl:"images/light_gray.png"
});
basemapGallery.add(basemap5);

var layer6 = new esri.dijit.BasemapLayer({
  url:"http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
});
var basemap6 = new esri.dijit.Basemap({
  layers:[layer6],
  title:"Topografisch",
  thumbnailUrl:"images/basemap_topographic.jpg"
});
basemapGallery.add(basemap6);

        basemapGallery.startup();
 
       
        dojo.connect(basemapGallery, "onError", function(msg) {alert(msg)});

      }

Outcomes