Select to view content in your preferred language

BasmapGallery,,,  Basemaps from two different locations?

799
2
05-21-2012 04:40 AM
AndrewDavis
Deactivated User
Hello,

I have a locally installed server which puts out geospatial content on an intranet setup. I have a number of different services which are consumed by folks in the office.

I am working on taking the BasemapGallery (dropdown example from the APIs) and have three services which are candidates for my dropdown. I have been able to put the services/basemaps together in the gallery and can switch between them IF THEY COME FROM THE SAME LOCATION ON THE SERVER..

Specifically, I have two which are located in Folder "A" and if I list them first in my code they will both open and display. However, the service which is in Folder "B" will only show its "Title" on the dropdown, but will not display. If I swap the services around, ie put the service in Folder "B" First... then it will display but not the services listed in Folder "A".

Is there a quick fix for this? or do I have to put code in to destroy/build dynamically the BasemapGallery based upon the DropDown Selection event? My code below.. ..

function createBasemapGallery(){
//Manually creating a list of basemaps to display
var basemaps = [];
var myStreets = new esri.dijit.BasemapLayer({url: "http://myLittleServer/rest/services/Folder_A/MapServer"});
var theStreets = new esri.dijit.Basemap({layers: [myStreets], title: "The StreetNetwork"});
basemaps.push (theStreets);

var myHouses = new esri.dijit.BasemapLayer({url: "http//myLittleServer/rest/services/Folder_B/MapServer"});
var theHouses = new esri.dijit.Basemap({layers:[myHouses], title: "The Houses"});
basemaps.push (theHouses);

basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: false,
basemaps: basemaps,
bingMapskey: bingKey,
map: map
});
//BasemapGallery.startup isnt needed because we aren't using the default basemap, instead
//we are going to create a custom user interface to display the basemaps, in this case a menu.
dojo.forEach(basemapGallery.basemaps, function(basemap) {
//Add a menu item for each basemap, when the menu items are selected
dijit.byId("bingMenu").addChild(new dijit.MenuItem({
label: basemap.title,
onClick: dojo.hitch(this, function() {
this.basemapGallery.select(basemap.id);
})
}));
0 Kudos
2 Replies
AndrewDavis
Deactivated User
Hello again..

I have gone back and noticed that the services in Folder A have a different Initial Extent than the services in Folder B.

Would this matter?  Both folders have services which are using a spatial reference of 4326.  The difference is the initial extent.

Andy..
0 Kudos
AndrewDavis
Deactivated User
The other difference between these two folders is the tiling scheme.

I have heard that the first tiled basemap/layer brought into the map object sets the tiling/cach level schema for the map.

Is this so?

Andy
0 Kudos