zoom slider bar

702
4
05-12-2011 11:05 AM
JulieRecker
New Contributor
hi,
newbie question here: i have a map viewer with a zoom slider bar (the default one) in the top left. problem is, the initial extent - which i define in my map constructor:

map = new esri.Map("map", { extent:initialExtent, logo:false});

the problem is the default view is halfway up the zoom bar (which only leaves around 3 tics until it is maxed out. what i would like is the default view to be at the bottom of the zoom slider so the user has several tics to zoom in further. in other words, so the user can only zoom in, not zoom out past my initial extent.

how would i do this?

thanks!
0 Kudos
4 Replies
HemingZhu
Occasional Contributor III
hi,
newbie question here: i have a map viewer with a zoom slider bar (the default one) in the top left. problem is, the initial extent - which i define in my map constructor:

map = new esri.Map("map", { extent:initialExtent, logo:false});

the problem is the default view is halfway up the zoom bar (which only leaves around 3 tics until it is maxed out. what i would like is the default view to be at the bottom of the zoom slider so the user has several tics to zoom in further. in other words, so the user can only zoom in, not zoom out past my initial extent.

how would i do this?

thanks!


Use the map option lods to specify the zoom level. like the following:
  var lods = [
            {
              "level": 13,
              "resolution": 19.1092570712683,
              "scale": 72223.819286
            },
            {
              "level": 14,
              "resolution": 9.55462853563415,
              "scale": 36111.909643
            },
            {
              "level": 15,
              "resolution": 4.77731426794937,
              "scale": 18055.954822
            },
            {
              "level": 16,
              "resolution": 2.38865713397468,
              "scale": 9027.977411
            },
            {
              "level": 17,
              "resolution": 1.19432856685505,
              "scale": 4513.988705
            },
            {
              "level": 18,
              "resolution": 0.597164283559817,
              "scale": 2256.994353
            },
            {
              "level": 19,
              "resolution": 0.298582141647617,
              "scale": 1128.497176
            }
            ];      
         ....
        map = new esri.Map("map", { extent: initialExtent, logo: false, slider: true, lods: lods });
0 Kudos
JulieRecker
New Contributor
thanks for your reply. i added the lods as suggested, and i'm seeing no change. for the map, i am loading first a dynamic layer, then 3 tiled layers. i used levels 0-6 of the tiled layers (all three had the same resolution and scale for each level id)

could it be since i'm defining my initial extent, and then using the dynamic layer as my first layer, it is ignoring lods?


thanks for the help
0 Kudos
HemingZhu
Occasional Contributor III
thanks for your reply. i added the lods as suggested, and i'm seeing no change. for the map, i am loading first a dynamic layer, then 3 tiled layers. i used levels 0-6 of the tiled layers (all three had the same resolution and scale for each level id)

could it be since i'm defining my initial extent, and then using the dynamic layer as my first layer, it is ignoring lods?


thanks for the help


First lods only apply for tiled map. The sample code i am using is for ESRI base map/google/bing tile scale level, you have to look into your serivce directory to set your lods. initial extent has not impact on scacle level once your specify map lods option. My sample worked on my project, i had esri base map as my first layer, so i guess lods is honored. Since i do not have a dynamic layer as my first layer, i am not sure if that is the cause but it is worth testing.
0 Kudos
JulieRecker
New Contributor
yep, after some more testing, i needed to add more levels than i did, and some of my json input had syntax errors, but now it works great. thanks for your help, you saved me hours of coding frustration!
0 Kudos