3.5api, Map created in wrong coordinate system? always 4326

380
3
07-16-2013 09:53 AM
JeffPace
MVP Alum
  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);


returns 4326?????????

I have tried everyway to set it I can.  I have no data or maps in 4326.  This is before any layers are even added.
0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor
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);
    });
});
0 Kudos
JeffPace
MVP Alum
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.
0 Kudos
KenBuja
MVP Esteemed Contributor
remove the basemap:"hybrid" line and it no longer works.  That is the problem.  I dont want to specify an esri basemap.


This code gives me the same wkid

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);
    });
});
0 Kudos