map = new esri.Map("map", { autoResize: true, sliderStyle : "large", extent: new esri.geometry.Extent({xmin:-9228363.6,ymin:3140074.58,xmax:-9116765.5,ymax:3202141.45,spatialReference:{wkid:102100}}) });
alert(map.spatialReference.wkid);
require(["esri/map"], function (Map) { var map; map = new Map("map", { basemap: "hybrid", autoResize: true, sliderStyle : "large", extent: new esri.geometry.Extent({xmin:-9228363.6,ymin:3140074.58,xmax:-9116765.5,ymax:3202141.45,spatialReference:{wkid:102100}}) }); map.on("update-end", function(){ alert(map.spatialReference.wkid); }); });
When do you call the alert? Using the following code, the alert says 102100.require(["esri/map"], function (Map) { var map; map = new Map("map", { basemap: "hybrid", autoResize: true, sliderStyle : "large", extent: new esri.geometry.Extent({xmin:-9228363.6,ymin:3140074.58,xmax:-9116765.5,ymax:3202141.45,spatialReference:{wkid:102100}}) }); map.on("update-end", function(){ alert(map.spatialReference.wkid); }); });
remove the basemap:"hybrid" line and it no longer works. That is the problem. I dont want to specify an esri basemap.
require(["esri/map"], function (Map) { var map; map = new Map("map", { autoResize: true, sliderStyle : "large", extent: new esri.geometry.Extent({xmin:-9228363.6,ymin:3140074.58,xmax:-9116765.5,ymax:3202141.45,spatialReference:{wkid:102100}}) }); var layerDynamic = new esri.layers.ArcGISDynamicMapServiceLayer("http://egisws02.nos.noaa.gov/ArcGIS/rest/services/biogeo/SEFCRI/MapServer") map.addLayers([layerDynamic]); map.on("update-end", function(){ alert(map.spatialReference.wkid); }); });