I add a ArcGISDynamicMapServiceLayer to the basemap, then when I am calling basemap.getZoom(), it always returns -1.
And the basemap.setZoom also doesn't work properly.
var option = {
// ESRI map options can be used still. For example, do not display "esri" logo.
logo : false,
center : [-74, 40.72],
maxZoom : 10,
minZoom : 1,
zoom : 3
};
var map = ... //create a esri map.
//then add layer to the map.
var layerConfig = {
url : "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer",
options : {
"opacity" : 0.5
};
var layer = new esri.layers.ArcGISDynamicMapServiceLayer(layerConfig.url,
layerConfig.options);
map.addLayer(layer);
//after the map is rendered and shown, then I call the get zoom function
var level = map.getZoom();
//the zoom level here is always -1, What I have set in the basemap is lost.
//and map.setZoom is also changed, although I can use map.setZoom(0) to zoom in and map.setZoom(1) to zoom out, but this
//kind of usage is not mentioned in the API
Thanks Manish,
For example, I add a map with optionsvar option = { // ESRI map options can be used still. For example, do not display "esri" logo. logo : false, center : [-74, 40.72], maxZoom : 10, minZoom : 1, zoom : 3 }; var map = ... //create a esri map. //then add layer to the map. var layerConfig = { url : "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer", options : { "opacity" : 0.5 }; var layer = new esri.layers.ArcGISDynamicMapServiceLayer(layerConfig.url, layerConfig.options); map.addLayer(layer); //after the map is rendered and shown, then I call the get zoom function var level = map.getZoom(); //the zoom level here is always -1, What I have set in the basemap is lost. //and map.setZoom is also changed, although I can use map.setZoom(0) to zoom in and map.setZoom(1) to zoom out, but this //kind of usage is not mentioned in the API
Hi Jerry,
Please take a look at this : http://jsfiddle.net/patelmanya/3FUbk/
let me know the results.
Thanks & regards,
Manish
Hi Manish,
Thanks a lot. I get the reason, in the example given by you, the basemap is rendered. But in our code we don't give the basemap property so no basemap rendered and then what I said happens.
Please look at below link:
http://jsfiddle.net/3FUbk/12/