World_Topo_Map initialExtent Error

Discussion created by tomneer on Sep 15, 2011
Latest reply on Sep 20, 2011 by DSwingley-esristaff
I'm finally getting around to learning the ArcGIS API for JavaScript and seem to run into a bug. It seems that the World_Topo_Map service will not take an initialExtent without erroring out to 0,0 (Lat/Lon). But the ESRI_StreetMap_World_2D works fine.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src=""></script>
    <link rel="stylesheet" type="text/css" href="">
    <script type="text/javascript">
      var myMap;
      function init() {
        myMap = new esri.Map("mapDiv");
        var spatialRef = new esri.SpatialReference({wkid:4326});
        var startExtent = new esri.geometry.Extent();
        startExtent.xmin = -124.71;
        startExtent.ymin = 31.89;
        startExtent.xmax = -113.97;
        startExtent.ymax = 42.63;
        startExtent.spatialReference = spatialRef;

        var mapServiceURL = "";
        //var mapServiceURL = "";
        //Using the World_Topo_Map does not show proper startExtent
        myMap.addLayer(new esri.layers.ArcGISTiledMapServiceLayer(mapServiceURL));
  <body class="tundra">
    <div id="mapDiv" style="width:1024px; height:800px; border:1px solid #000;"></div>


Comment/uncomment to toggle the layers. If someone could confirm that I'm not going insane and my code is correct, it would be greatly appreciated. TIA -Tom