Select to view content in your preferred language

Thumbnail url for BaseMapLayer by type?

2327
5
06-02-2011 11:47 AM
BrettLord-Castillo
Deactivated User
When you create a BaseMapLayer using the type argument, e.g.
esri.dijit.BasemapLayer({
     type: "OpenStreetMap"
});
there does not seem to be any way to get the thumbnail url for that type.
Is the only choice to hardcode the url? Is there some way to retrieve the appropriate url and use it when creating a basemap from that basemap layer?
This is part of a project to update my widgit of a dijit.layout.ContentPane with an embedded map object and now an embedded gallery. I would like the addBasemap layer function on that widget to be able to accept a basemap layer type as an argument, but it looks a bit dumb when the thumbnail is blank.
0 Kudos
5 Replies
HemingZhu
Frequent Contributor
When you create a BaseMapLayer using the type argument, e.g.
esri.dijit.BasemapLayer({
     type: "OpenStreetMap"
});
there does not seem to be any way to get the thumbnail url for that type.
Is the only choice to hardcode the url? Is there some way to retrieve the appropriate url and use it when creating a basemap from that basemap layer?
This is part of a project to update my widgit of a dijit.layout.ContentPane with an embedded map object and now an embedded gallery. I would like the addBasemap layer function on that widget to be able to accept a basemap layer type as an argument, but it looks a bit dumb when the thumbnail is blank.


Maybe this is not you are looking for, i think this esri sample might give me some clue: http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/widget/widget_basemapsthumbnail.html
0 Kudos
BrettLord-Castillo
Deactivated User
That is using the standard basemaps. I'm trying to retrieve a thumbnail when using the layer by type constructor. There is a workaround for this I think, but that requires diving into the private members of the class I think.
0 Kudos
HemingZhu
Frequent Contributor
That is using the standard basemaps. I'm trying to retrieve a thumbnail when using the layer by type constructor. There is a workaround for this I think, but that requires diving into the private members of the class I think.


Does this code snippet anwser your question?

dojo.connect(basemapGallery, "onSelectionChange", function() {
            var basemap = basemapGallery.getSelected();
            var basemapLayer = basemap.getLayers();
            alert("basemap thumbnail url: " + basemap.thumbnailUrl);
            alert("basemap url: " + basemapLayer[0].url);
});
0 Kudos
BrettLord-Castillo
Deactivated User
Nope. The thumbnail Url is blank.
0 Kudos
DEWright_CA
Frequent Contributor
Did you define your thumbnail URL?

var streetBasemap = new esri.dijit.Basemap({
        layers: [streetTemplateLayer],
        title: "Streets",
        thumbnailUrl: resPath + "/images/toolbar/Streets.png"
    });
    basemaps.push(streetBasemap);


So it would know what URL to use?
0 Kudos