AnsweredAssumed Answered

Setting initial extent sets to closest zoom level in basemap

Question asked by lorieme on Mar 13, 2017
Latest reply on Mar 14, 2017 by lorieme

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

Outcomes