Reputation: 1024
I was wondering how to set the predefined zoom levels in the arc gis map. My ultimate goal is if the user zooms out past level 5 turn off the labels. Other wise every thing under level 4 show the labels. I've set the zoom level to 7 and initial load this works correctly. But when I log the zoom level to the console I get -1 and a description of no predefined zoom levels. Obviously I'm missing something here but what, wouldnt the log show a zoom level of 7 since that is what is defined for the map?
function init() {
esri.config.defaults.io.proxyUrl = WebRoot + "proxy.ashx ";
map = new esri.Map("mapDiv", {
basemap: "gray",
sliderStyle: "large",
center: [-95.625, 39.243],
nav: false,
logo: false,
zoom: 7
});//end base map
//create feature layer
fl = new esri.layers.FeatureLayer(app.regionMap, {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
outFields: ["FIPS"],
opacity: 0.3,
visibile: true
});//ends feature layer
//add feature layer to map
map.addLayer(fl);
Upvotes: 0
Views: 1294
Reputation: 1220
You need to set the LODs, or Level of Detail. This is an array provided in the options when you initialise the map, as shown in the documentation.
You can pull the LODs from a tiled map layer that you load, as in this sample, or define them yourself, eg:
_LODS : [
{"level" : 0, "resolution" : 156543.033928, "scale" : 591657527.591555},
{"level" : 1, "resolution" : 78271.5169639999, "scale" : 295828763.795777},
{"level" : 2, "resolution" : 39135.7584820001, "scale" : 147914381.897889},
//...etc
]
Upvotes: 1