setting the map extent in javascript

3186
2
06-18-2015 03:00 AM
NigelDsouza
Occasional Contributor

HI,

I am initializing a map without giving an extent or a center in the map constructor.

After this I am using the basemap gallery dijit and loading custom basemaps into it.

Post this, I am then adding  my operational layers to the map.

I want to then set the extent to the map but how do I know what co-ordinates to pass in?

regards,

Nigel

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Nigel,

The spatial reference of the map with be that of the first layer you add.  When setting the extent, you should use the coordinates of this spatial reference.

NigelDsouza
Occasional Contributor

Hi Jake,

Thanks alot that's absolutely right. suppose I add my basecustom base map to the basemap array in the basemapgallery. Then how do I set this base map as the default basemap that should appear instead of setting someting like

map.basemap = 'topt' etc. I wouyld like to set my custom basemap when the map loads?

Regards,

Nigel.

0 Kudos