Setting initial extent sets to closest zoom level in basemap

1404
2
Jump to solution
03-13-2017 02:23 PM
LoriEmerson_McCormack
Occasional Contributor

I am trying to set the initial extent for my map that uses the ESRI "topo" basemap.  My map service is in a different spatial reference, therefore, I am using the spatial reference of the basemap to set my min/max x/y values.  However, whatever I set my extent values, the map either sets to zoom level 9 or 10 in the "topo" basemap.  I tried using "fitExtent: true".

When I comment out the 'basemap: "topo," statement, then the initialExtent works.  

Question:  How can I override the zoom levels of the basemap when setting my initial Extent? 

my JavaScript:

// wkid: 102100 or 3857 is the spatial reference of basemap
// basemap url: https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer
var initialExtent = new esri.geometry.Extent(
   -13115148, 5969306,
   -13028889, 6120000,
new esri.SpatialReference({ wkid: 3857 })
);

map = new Map("mapDiv", {
   basemap: "topo",
   sliderOrientation: "vertical",
   sliderPosition: "top-left",
   extent: initialExtent,
   fitExtent: true,
   sliderStyle: "small"
}); //end map

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

When you use a basemap, you are locking yourself into using the LODs (Levels of Detail) with specific scales that are used by that basemap. That means you can't zoom to an intermediate scale between two LODs

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

When you use a basemap, you are locking yourself into using the LODs (Levels of Detail) with specific scales that are used by that basemap. That means you can't zoom to an intermediate scale between two LODs

LoriEmerson_McCormack
Occasional Contributor

Thank you.

0 Kudos