Select to view content in your preferred language

JavaScript Api 4.x how to get Zoom and Center of current map

6171
2
Jump to solution
12-12-2017 06:39 AM
NathanielEvatt
Occasional Contributor

I can't seem to find the method for returning the zoom level or center in lat/lng for a user's map.

To clarify goTo() does the reverse of what i want. 

Any help?

Thanks

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Nataniel,

   You get the views properties for center and zoom. The point class that is returned from view center has properties of  Latitude and Longitude if the view is in web mercator or WGS 84.

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#center 

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#zoom 

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Nataniel,

   You get the views properties for center and zoom. The point class that is returned from view center has properties of  Latitude and Longitude if the view is in web mercator or WGS 84.

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#center 

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#zoom 

NathanielEvatt
Occasional Contributor

Awesome, thanks Robert.  The properties, so simple.

0 Kudos