Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

    }
share|improve this question
    
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
add comment

1 Answer 1

Found it out in the API Reference:

http://help.arcgis.com/EN/WEBAPI/JAVASCRIPT/ARCGIS/help/jsapi_start.htm#jsapi/basemaplayer.htm

var openstreetmap = new esri.dijit.Basemap({
      layers: [new esri.dijit.BasemapLayer({
        type: "OpenStreetMap"
      })],
      id: "OpenStreetmap",
      title: "Open Street Map",
        thumbnailUrl:"images/OpenStreetMap.png"

    });
    basemapGallery.add(openstreetmap);

Thanks for helping

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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