Map extent is overridden

867
7
Jump to solution
03-06-2014 05:30 AM
vinayb
by
New Contributor III
HI All,

   I have set initial extent while initializing the map  and i also have written onExtentChange event where i am logging the extent of map for some reason when the map gets initialized the map extent is not what the extent i had set.Can anybody let me know the reason behind this.
0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor
It's probably the map adjusting to fit the viewable space.
If you provide an extent of 100x100, but the browser page or map DOM element is only 75x95, the map will adjust to fit in that space.

You could try and set the center and zoom level when the map loads using the mapOptions and then the map is loaded, set the initialExtent to the extent at load, so if you want to return to that initial extent via a Home button or something, you can.

View solution in original post

0 Kudos
7 Replies
ReneRubalcava
Frequent Contributor
It's probably the map adjusting to fit the viewable space.
If you provide an extent of 100x100, but the browser page or map DOM element is only 75x95, the map will adjust to fit in that space.

You could try and set the center and zoom level when the map loads using the mapOptions and then the map is loaded, set the initialExtent to the extent at load, so if you want to return to that initial extent via a Home button or something, you can.
0 Kudos
vinayb
by
New Contributor III
How to re set the extent of map can you please ?
0 Kudos
KenBuja
MVP Esteemed Contributor
This could be an issue of setting the extent of a tiled map. Since the tiled map will only show at specific zoom levels, the extent that you explicitly set may not be the same extent as the map's zoom level will allow. Have you tried setting the extent using only a dynamic service (and no basemap)?
0 Kudos
vinayb
by
New Contributor III
I am not using tiled service , but i just got one doubt can we create map without base map ? ( i know i can initialize map without base map )
0 Kudos
KenBuja
MVP Esteemed Contributor
I'm suggesting you try that as a test to see if you're having an issue setting the map extent.
0 Kudos
JeffPace
MVP Alum
onextentchange is called once on map initialization
0 Kudos
vinayb
by
New Contributor III
THanks jeff and ken
0 Kudos