Is there a way to get the full extent of a map? I am looking to use this extent to zoom out to whole world view on a button click.
3 Answers
the full extent of a particular layer can be retrieved by the aptly named 'fullExtent' property. The value it returns can be passed to map.setExtent() in order to accomplish this dynamically if its not sufficient to pass static values to zoom out and view the entire world.
See the API reference for more information https://developers.arcgis.com/javascript/jsapi/arcgisdynamicmapservicelayer-amd.html#fullextent https://developers.arcgis.com/javascript/jsapi/arcgistiledmapservicelayer-amd.html#fullextent
-
1
I think the easiest way would be to use map.CenterAndZoom the following:
button.on('click', function(){
var location = [-155.79719, 14.03035];
//Any location around the equator
map.centerAndZoom(location, 2);
});
A zoom level of 2 will show the entire map. If you dont want to use this a second option would be to use the Extent class.
-
Thanks, this solution worked when I changed the zoom level to 1. Jul 18, 2014 at 15:11