Invoke zoom/pan event using JS API

1189
2
06-28-2012 08:13 PM
HarshanaDias
New Contributor
Hi All,

How to invoke a the zoom or pan with out trigger an event. I mean with out mouse scroll or click on zoom panel, how can i invoke the same in code level using a JS function.

Thank You.
0 Kudos
2 Replies
PramodHarithsa1
Occasional Contributor II
Hi All,

How to invoke a the zoom or pan with out trigger an event. I mean with out mouse scroll or click on zoom panel, how can i invoke the same in code level using a JS function.

Thank You.


If you are using a tiledmapservice then you can go for
centerAndZoom(mapPoint, levelOrFactor)

use 0.5 to zoom in twice as far and 2.0 to zoom out twice as far.

or else you you go with
map.setExtent(map.extent.expand(0.5));
for Zooming in and
map.setExtent(map.extent.expand(2));
for Zooming out.

For Pan you can use the functions panUp(),pannDown(), panLeft(), panRight()
You can find more about the map navigation hereand here


Mark this as an answer if it helped you.
0 Kudos
JohnnyPenet
New Contributor
Harshana,

You can find some more advanced examples on my blog http://jpenet.blogspot.be/2012/04/arcgis-javascript-api-using-basic-gis.html

Johnny
0 Kudos