AnsweredAssumed Answered

Set start location based on extents rather than a centre point and zoom

Question asked by ppaireland on Feb 1, 2017
Latest reply on Feb 1, 2017 by ppaireland

Hi,

 

The JS API samples show how to create a map, but the starting location/zoom is always based on a Lat,Lng pair along with a zoom level. Is it possible to override these parameter using a bounding box coordinate pair, or similar and the centre + zoom level is picked up automatically from there?

 

API Samples usually have:

map = new Map("map", {
      basemap
: "topo",
      center
: [-108.663, 42.68],
      zoom
: 6
   
}

 

Whereas I would need something like:

map = new Map("map", {
      basemap
: "topo",
      bounds
: [-108.663, 42.68;-107.63, 43.68]
    }

 

So the zoom takes care of itself and it isn't required.

 

Thanks for any help you can offer. Used to doing this through Google Maps API, now trying to switch over to the JS API for the increased GIS functionality.

 

BC

Outcomes