pbinns

Can't get correct extent on World Stree Map

Discussion created by pbinns on Feb 1, 2012
Latest reply on Feb 1, 2012 by DSwingley-esristaff
I'm a beginner to the ESRI API and scripting in general. I'm trying to make a basic web map with the World_Street_Map layer but the extent I use shows "no map data available" because it's off in the ocean on the wrong side of the world! If I use that same extent (same x y coordinates) with the ESRI_StreetMap_World_2D layer it works fine though. Can anyone give me some advice on what I'm missing? Any help would be appreciated because I'm stuck right now.

Here's the code for the test that uses the World_Street_Map (the one that's not working)...

function init() { 
  var startExtent = new esri.geometry.Extent(-95.4, 40.887, -94.908, 41.171,         
      new esri.SpatialReference({wkid:102100}) ); 

myMap = new esri.Map("mapDiv", { extent: startExtent }); 
  var mapServiceURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"; 
myMap.addLayer(new esri.layers.ArcGISTiledMapServiceLayer(mapServiceURL));

}

Here's the code for the test that uses the ESRI_StreetMap_World_2D layer (the one that works fine)...

function init() { 
  var startExtent = new esri.geometry.Extent(-95.4, 40.887, -94.908, 41.171,         
      new esri.SpatialReference({wkid:4326}) ); 

myMap = new esri.Map("mapDiv", { extent: startExtent }); 
  var mapServiceURL = "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"; 
myMap.addLayer(new esri.layers.ArcGISTiledMapServiceLayer(mapServiceURL));

}

Outcomes