I don't 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 base maps that I don't 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"


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


 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"



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

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


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

  • Better like this? – Babboe Dec 17 '12 at 10:42
  • This (help.arcgis.com/en/webapi/javascript/arcgis/help/…) might useful..I am researching on your question.. – Sunil Dec 17 '12 at 10:51
  • I saw that one yes, but how do i do that as a basemap. – Babboe Dec 17 '12 at 10:52
  • According to my knowledge..you have to insert your layers in above code..Its already the OSM base map.Try to add sample layer then check.At my end the display is blank & I think OSM service is not working. – Sunil Dec 17 '12 at 11:00
  • 1
    Already found it in the API Reference – Babboe Dec 17 '12 at 11:04

Found it out in the API Reference:


var openstreetmap = new esri.dijit.Basemap({
      layers: [new esri.dijit.BasemapLayer({
        type: "OpenStreetMap"
      id: "OpenStreetmap",
      title: "Open Street Map",


Thanks for helping

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.