Maximum extent

I have 2 layers.The bottom layer is the "World_Street_Map" tiled map service.The top layer is a dynamic layer covers a portion of New York State.I set the initial extent to the extent of the dynamic layer.

If I zoom all the way out with the ZoomSlider or with "navToolbar.zoomToFullExtent()" it zooms to the entire world. How can I constrain the map so the maximum extent is equal to the extent of the dynamic layer?

You need to define an array of LODs (Levels of Detail) to specify the zoom levels. Each LOD corresponds to a map at a given scale or resolution. Then, apply the array of LODs in the map constructor as an option. For example:

Note that this only restricts you to the same zoom level as the maximum extent of the layer - you'll still be able to pan to another location.

If that's a problem (ie, you want to prevent the user from navigating away from the study area) you could write a function which examines the map extent after panning or zooming (see the onExtentChange event) and nudges it back to the desired extent.

Note that this only restricts you to the same zoom level as the maximum extent of the layer - you'll still be able to pan to another location.

If that's a problem (ie, you want to prevent the user from navigating away from the study area) you could write a function which examines the map extent after panning or zooming (see the onExtentChange event) and nudges it back to the desired extent.

Steve

Indeed, I'd like to prevent the user from navigating away from the study area. I'm not really a crack in writing functions using JavaScript. How should such a function look like?