LuciH

basemap or featurelayer which one sets projection

Discussion created by LuciH on Jul 3, 2012
Latest reply on Jul 5, 2012 by jeff.pace
Hi All,

I have been playing around with trying to load data from a config.txt file

I am using the Basemap Gallery for my background maps and I am also loading several dynamic map service layers.  It seemed as though the projection was being set from the first feature layer loaded and not the first basemap loaded. 

But, upon investigation it seems as though I am getting different projections based upon the method used to set the map extent.  Can someone explain to me what the difference is between the two methods below because when I use Method 1 everything lines up properly, but, when I use Method 2 my Basemaps are fine, but my dynamic feature layers are over in Africa...

Method 1:

All of the below is in my default.html file

var initExtent = new esri.geometry.Extent({"xmin":-9654356.83267948,"ymin":3553252.14612359,"xmax":-9631845.86180353,"ymax":3569377.06341259,"spatialReference":{"wkid":102100}});

map = new esri.Map("map", {
    extent: initExtent,
    slider: true,
    lods: lods,
    infoWindow: popup
   });


Method 2:

This is config.txt

{
'DefaultExtent' : "-9654356.83267948, 3553252.14612359, -9631845.86180353, 3569377.06341259"
}

This is in my default.html file

var mapExtent = responseObject.DefaultExtent;
var mapExtent2 = mapExtent.split(',');

map = new esri.Map("map", {
    slider: true,
    lods: lods,
    infoWindow: popup
   });

map.setExtent(new esri.geometry.Extent(parseFloat(mapExtent2[0]), parseFloat(mapExtent2[1]), parseFloat(mapExtent2[2]), parseFloat(mapExtent2[3]),  new esri.SpatialReference({ wkid: 102100 })));


Thanks,

Luci

Outcomes