AnsweredAssumed Answered

set extent for DynamicMapServiceLayer

Question asked by roryhall on Jan 28, 2012
Latest reply on Jan 30, 2012 by roryhall
Hello, I have been working though the various examples of the JavaScript API with good success I might add, but have decided to venture outside the sample server of ESRI and have come unstuck. I have two layers esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer") and new esri.layers.ArcGISDynamicMapServiceLayer("http://maps.esriaustralia.com.au/ArcGIS/rest/services/BOM/YasiCycloneTrack/MapServer");. If I do not set and extent the map works fine, but I want to set the extent to the second layer. When I try this the map no longer draws. I am thinking it has something to do with different spatial references but am able to get my head around the problem.
my code as follows:
<script type="text/javascript">     
      dojo.require("esri.map");           
      var map;     
      function init(){         
      map = new esri.Map("map");
      //map = new esri.Map("map",{extent: new esri.geometry.Extent({xmin:123.837890625, ymin:-36.2109375, xmax:176.572265625, ymax:-1.0546875} )});
      var tiled = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer");
      map.addLayer(tiled);  
      var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://maps.esriaustralia.com.au/ArcGIS/rest/services/BOM/YasiCycloneTrack/MapServer");    
      map.addLayer(layer);    
       }     
       dojo.addOnLoad(init);
</script>

TIA ~ Rory

Outcomes