Description
Class added v2.1
dojo.require("esri.dijit.BasemapGallery");
The BasemapGallery dijit displays a collection basemaps from ArcGIS.com
or a user-defined set of map or image services. When a new basemap is selected
from the BasemapGallery the basemap layers are removed from the map and
the new layers are added.
All basemaps added to the gallery need to have the same spatial reference.
If the default ArcGIS.com basemaps are used then all additional items added
to the gallery need to be in Web Mercator (wkids: 102100, 102113 and 3857).
If the default basemaps are not used you can add basemaps in any spatial
reference as long as all the items added to the gallery share that spatial
refrence. To achieve the best performance, it is recommended that all
basemaps added to the gallery are cached (tiled) layers.
The following table lists the CSS class names used by the basemap gallery
to refer to the DOM nodes it creates. The class names can be used to customize
the look and feel of the widget.
CSS Classes
|
esriBasemapGallery
|
Represents the node where an instance of the basemap gallery is rendered.
|
|
esriBasemapGalleryNode
|
Represents a gallery item node that contains a thumbnail and label.
|
|
esriBasemapGallerySelectedNode
|
The currently selected item node. This snippet modifies the selected color
for items in the gallery.
.esriBasemapGallerySelectedNode .esriBasemapGalleryThumbnail{
border-color: #66FFFF !important;
}
|
|
esriBasemapGalleryThumbnail
|
A node that contains a thumbail image
|
Samples
Search for
samples that use this class.
Class hierarchy
esri.dijit.BasemapGallery
Constructor
Methods
| destroy() |
none
|
Destroys the basemap gallery. Call destroy() when the widget is no longer needed by the application. |
| startup() |
none
|
Finalizes the creation of the basemap gallery. Call startup() after creating the widget when you are ready for user interaction. |
Events
| onError()
|
Fires when an error occurs while switching basemaps. |
Constructor Detail
esri.dijit.BasemapGallery(params, srcNodeRef)
Creates a new BasemapGallery dijit.
Parameters:
|
<Object>
params |
Required |
Parameters used to configure the widgit. See the list below for details.
|
|
<String>
srcNodeRef |
Required |
Reference or id of the HTML element where the widget should be rendered.
|
Options:
|
<String[]>
basemapIds |
Optional. List of basemap layer ids in the current map. These layers will be removed when switching to a new basemap.
|
|
<Basemap[]>
basemaps |
Optional. An array of user-defined basemaps to display in the BasemapGallery.
var basemaps= [];
var waterBasemap = new esri.dijit.Basemap({
layers:[waterTemplateLayer],
title:"Water Template",
thumbnailUrl:"images/waterThumb.png"
});
basemaps.push(waterBasemap);
|
|
<String>
bingMapsKey |
Optional. Specify your Bing Maps key. If no Bing Maps key is provided Bing Map types will not be displayed in the BasemapGallery. For more information about see the Getting started with Bing maps in the ArcGIS JavaScript API help topic.
|
|
<Map>
map |
Reference to the map. The map parameter is required.
|
|
<String[]>
referenceIds |
Optional. List of reference layer ids in the current map. Reference layers are displayed on top of the map and usually contain information like place boundaries or labels. All layers specified by the referenceIds will be removed when switching to a new basemap.
|
|
<Boolean>
showArcGISBasemaps |
Optional. When true, queries ArcGIS.com to retrieve available basemaps. When false, only user-defined basemaps specified using the basemaps property are displayed.
|
Code snippets:
basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "basemapGalleryDiv");
Methods Detail
Destroys the basemap gallery. Call destroy() when the widget is no longer needed by the application.
Return value: none
Finalizes the creation of the basemap gallery. Call startup() after creating the widget when you are ready for user interaction.
Return value: none
Code snippets:
basemapGallery.startup();
Events Detail
Fires when an error occurs while switching basemaps.
Code snippets:
dojo.connect(basemapGallery, "onError", function(error) {console.log(error)});