arzanna

FeatureLayer (wkid:102100) fails to display on top of basemap (Ligth Grey Canvas)

Discussion created by arzanna on Oct 25, 2011
Hi,

I am using JavaScript API 2.5 to display a feature layer on the top of ESRI base map (the LightGrey Canvas). My feature layer is an ArcGIS Rest service with the same wkid as basemap:102100. However, my feature layer fails to display on the map. Can anyone help me with this, perhaps I am doing something wrong.

Here is my code:

<script type="text/javascript" language="Javascript">
      dojo.require("esri.map");
      dojo.require("esri.layers.FeatureLayer");

      function init() {
        var startExtent = new esri.geometry.Extent({"xmin":-15324083.521730602,"ymin":-9141606.801736668,
"xmax":19898099.112069488,"ymax":14339848.287463393,"spatialReference":{"wkid":102100}});
        var map = new esri.Map("map", {extent:startExtent});
        
        var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer");
        map.addLayer(basemap);
   
        var myLayer = new esri.layers.FeatureLayer("http://myserver_here/MapServer/0", {
         mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
         outFields: ["*"]
        });
        
        map.addLayer(myLayer);

        dojo.connect(map, 'onLoad', function(theMap) {
          //resize the map when the browser resizes
          dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
        });
       
      }

      dojo.addOnLoad(init);
</script>

Thanks!
Anna

Outcomes