map.centerAndZoom()function.
Solved! Go to Solution.
Hi,
I have two external button for zoomin and zoom out.
on click of zoomin button i am usingmap.centerAndZoom()function.
But it doesnt work for me.
i want the extent to be maximixed and minimized..
when use this,
map.centerAndZoom((0,0),1)
map.centerAndZoom((0,0),2)
map centers to one position.. how do i make it dynamic..
i.e., on click on button it should keep zooming in.. and similarly the zoom out button as well
what other functions for the same can i manifest?
If you're using a tiled service, you can get the map's level, add or subtract one from it depending on which button is clicked and pass that as the second argument to centerAndZoom.
If you're not using a tiled service, centerAndZoom probably isn't what you want. Rather, try building a new extent and using map.setExtent. More info about using extents: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_extents.htm
Hi,
I have two external button for zoomin and zoom out.
on click of zoomin button i am usingmap.centerAndZoom()function.
But it doesnt work for me.
i want the extent to be maximixed and minimized..
when use this,
map.centerAndZoom((0,0),1)
map.centerAndZoom((0,0),2)
map centers to one position.. how do i make it dynamic..
i.e., on click on button it should keep zooming in.. and similarly the zoom out button as well
what other functions for the same can i manifest?
Try this:
For ZoomIn Button:
var extent=map.extent;
map.setExtent(extent.expand(0.5));
For ZoomOut Button:
var extent=map.extent;
map.setExtent(extent.expand(2));
Thanks a lot Zhu, That worked for me..
where can i get such methods described? I was looking here http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp_start.htm