2

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 3

4

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
  • 1
    This is exactly what I was looking for. Jul 21, 2014 at 20:57
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.

1
  • Thanks, this solution worked when I changed the zoom level to 1. Jul 18, 2014 at 15:11
1

With the 4.x API you just set the extent property on the map view object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.