basemap gallery error:    esri.dijit.BasemapGallery: could not find group for basemap

1341
3
Jump to solution
09-16-2013 03:11 PM
PamelaBond
New Contributor III
WARNING: I am very new to using JavaScript and making custom web map application so please keep it simple. 😉

I would like to add the Basemap Gallery widget to my web map application. I have already successfully accomplished this on another application and just can't seem to figure out where the difference is. I started off creating this application by downloading an ArcGIS Online web map application template (I am starting to think I should just start from scratch and it would cause less headaches).  When I insert the same code in the map.js file as I used for a previous application where the basemap gallery appeared and function perfectly, I received this error message "basemap gallery error: esri.dijit.BasemapGallery: could not find group for basemap".

The application can be found at: http://fishandgame.idaho.gov/ifwis/maps/WildlifeTracts/

My code is attached.
0 Kudos
1 Solution

Accepted Solutions
JasonZou
Occasional Contributor III
map in esri.dijit.BasemapGallery should refer to the map object used in your app, while _maps is an array of map objects. Matter of fact, _maps only contains one map object. Don't know why need an array here. Anyway, here is the change you can make.

Try to change:

  var basemapGallery = new esri.dijit.BasemapGallery({
    showArcGISBasemaps: true,  
     map: _maps
}, "basemapGallery");


To:

var basemapGallery = new esri.dijit.BasemapGallery({     showArcGISBasemaps: true,         map: _maps[0] }, "basemapGallery");

View solution in original post

3 Replies
JasonZou
Occasional Contributor III
map in esri.dijit.BasemapGallery should refer to the map object used in your app, while _maps is an array of map objects. Matter of fact, _maps only contains one map object. Don't know why need an array here. Anyway, here is the change you can make.

Try to change:

  var basemapGallery = new esri.dijit.BasemapGallery({
    showArcGISBasemaps: true,  
     map: _maps
}, "basemapGallery");


To:

var basemapGallery = new esri.dijit.BasemapGallery({     showArcGISBasemaps: true,         map: _maps[0] }, "basemapGallery");
PamelaBond
New Contributor III
Thanks Jason.  That worked for me.  The code originally came from an ArcGIS Online web application template (I am still learning to customize) so the code for an array of maps object stemmed from that.  I am still learning - maybe I will figure out how to change it so it is just referencing my map.  Thanks again!
0 Kudos
JasonZou
Occasional Contributor III
Glad to help, Pamela. Please consider to mark this thread as "Answered" so other people may find it helpful. Thanks.
0 Kudos