AnsweredAssumed Answered

Setting Map Extent Based on Layer Extent

Question asked by deleted-user-1_r2dgYuILKY on Jan 4, 2018
Latest reply on Jan 11, 2018 by deleted-user-1_r2dgYuILKY

I want to set my map's extent to the extent of a feature layer. This layer will be updated regularly and the extent will be different every time. I'm following this example, and substituted my layer. It's not showing up, and the extent is far to the north of my feature. I'm getting this error in the console: Map: Geometry (wkid: 3395) cannot be converted to spatial reference of the map (wkid: 102100). I've tried setting the spatial reference of the map and the layer, to no avail. 


  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> 
  <title>Resource Loader Test</title> 
  <link rel="stylesheet" href=""> 
  <link rel="stylesheet" href=""> 
  <script src=""></script> 
      function (Map, FeatureLayer, Extent, SpatialReference, on) { 
       var typhoonOutlineURL = "http://<ourserver>/arcgis/rest/services/typhoon_outlines/MapServer/0";
        var myLyr = new FeatureLayer(typhoonOutlineURL, { 
          mode: FeatureLayer.MODE_ONDEMAND, 
        myLyr.on('load', initMap); 
        function initMap() { 
          var mapMain = new Map("mapDiv", { 
            basemap: "dark-gray", 
            extent: myLyr.fullExtent, 
            zoom: 3
<body class="claro"> 
  <div id="mapDiv" style="width:900px; height:600px;"></div> 
  <div id="mapInfo"></div>