AnsweredAssumed Answered

Basemaps, basemap gallery, base map switch, map all with my own basemaps

Question asked by amarsden on Nov 17, 2014
Latest reply on Nov 17, 2014 by amarsden

OK, I am having issues getting my head round all these items whilst using my own basemaps.


In my code, I create the map object.  I do not set the basemap property.


I want to add two basemaps, a topo and photographic


I can see how to add to them to a gallery, but by that time the map object is defined, so how do I set the basemap?


I keep going round in circles - this is as far as I have got. - mainly from example code


    map = new Map("mapDiv", {
        logo: false
    var basemapGallery = new BasemapGallery({
        showArcGISBasemaps: false,
        map: map
    }, "basemapGallery");
    var layer = new BasemapLayer({
        url: "http:/xxx/arcgis/rest/services/bmap1/MapServer"
    var basemap = new Basemap({
        layers: [layer],
        title: "Street Map",
        thumbnailUrl: "pin.gif"
     var layer2 = new BasemapLayer({
         url: "http://xxx2/arcgis/rest/services/LIVEinternal/aerials/MapServer"
     var aerial = new Basemap({
         layers: [layer2],
         title: "Aerials",
         thumbnailUrl: "pin.gif"

     var toggle = new BasemapToggle({
         map: map,
         basemap: "StreetMap"
     }, "BasemapToggle");


But hit issues - what do I use in the Basemap property of the toggle - the help says "The secondary basemap to toggle to." but the ID, the title?  I've tried both and they both fail with various errors


Also, how do you get the initial basemap of the map object.


Is it just me, or does the official help really suck when it comes to daring to use your own data?