Select to view content in your preferred language

Center and zoom issue

3427
3
11-23-2013 01:16 AM
NivM
by
Emerging Contributor
Hi,

I have couple of questions.

I tried to preform center and zoom action (to a point) on my map.
My issue is that the zoom is affect by the factor (that sended to the action with the x,y point) and i can not set a maximun zoom
(i mean that 2 center and zoom actions will make the zoom so big, so the map can not be seen).

I want to understand how can i set the map and zoom dynamic,
how can i get the current map zoom
and what is the different between using the center and zoom action and the set extant action?

Thank you
Niv
0 Kudos
3 Replies
JohnathanBarclay
Regular Contributor
The difference between centerAndZoom and setExtent is that centerAndZoom centers on a point (x,y) and set extent uses an extent (minx,miny,maxx,maxy).

I think what you are looking for is map.centerAt(point). This centers at a point without changing the zoom factor.
0 Kudos
RobertMaiden
Deactivated User

I have a similar problem.  I am calling a module in which I want to use center and zoom. I do not want to use extent because that would require 4 entries of non human-relatable location points plus the zoom factor per location.  I have tried the documentation for center and zoom but I cannot find the right formula (code) to use in the called module via require.  I have tried passing the map object as a variable to the module and even though the map object is declared globally, it is not recognized in the module.  What do I need to do to get center and zoom to function appropriately?

0 Kudos
NicholasHaney
Regular Contributor

If you pass the map object to your module as a parameter in the constructor you should be able to access that map's properties and methods. Almost all of the widgets in the API have the map object passed to them in this manner. Do you have a code sample available that I can test?

0 Kudos