map.centerAndZoom()
Hi,I have two external button for zoomin and zoom out.on click of zoomin button i am using map.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 wellwhat other functions for the same can i manifest?
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
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));
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
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.