Select to view content in your preferred language

Tiled layer does not display all levels

672
3
12-16-2011 11:10 AM
MikeOnzay
Frequent Contributor
I'm using two tiled services to display in my map. The ocean basemap and the world light gray canvas map. If I zoom past level 9 on the US Virgin Islands, the ocean basemap shows me "map data not yet available". I understand that part. What I don't understand is why the other basemap I've set up to display on the map does not appear until level 14. This happens regardless if I use the displayLevels parameter. Yet, if I look at that service through the services directory in the Javascript viewer I can see all of the levels including the ones between 9 and 14.


 
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
    <!--The viewport meta tag is used to improve the presentation and behavior of the samples
      on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>
      Overview Map
    </title>
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.6/js/dojo/dijit/themes/claro/claro.css">
    <style>
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
    </style>
    <script type="text/javascript">
      var djConfig = {
        parseOnLoad: true
      };
    </script>
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6">
    </script>
<script type="text/javascript">
      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("esri.map");
      dojo.require("esri.dijit.OverviewMap");
      var map;

      function init() {
        var initExtent = new esri.geometry.Extent({
          "xmin":-7413378.648884336,"ymin":1898800.4677371255,"xmax":-7031499.25557178,"ymax":2094785.0082602233,"spatialReference":{"wkid":102100}
        });
        map = new esri.Map("map", {
          extent: initExtent
        });

        //resize the map when the browser resizes - view the 'Resizing and repositioning the map' section in
        //the following help topic for more details http://help.esri.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_guidelines.htm
        var resizeTimer;
        dojo.connect(map, 'onLoad', function(theMap) {
          //resize the map when the browser resizes
          dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
        
          //add the overview map
          var overviewMapDijit = new esri.dijit.OverviewMap({
            map: map
   });
          overviewMapDijit.startup();
        });

 

 
  basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer",{displayLevels:[10,11,12,13,14,15,16]});
  map.addLayer(basemap);
 
   oceanBM = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer");
  map.addLayer(oceanBM);
 



      }

      dojo.addOnLoad(init);
    </script>

</script>
  </head>

  <body class="claro">
    <div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width: 100%; height: 100%; margin:0;">
      <div id="map" dojotype="dijit.layout.ContentPane" region="center" style="padding:0">
      </div>
    </div>
  </body>

</html>

					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos
3 Replies
SumitSharma
Occasional Contributor
Hello mike,

Please try the following and see if this works!!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>
Overview Map
</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.6/js/dojo/dijit/themes/claro/claro.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
</style>
<script type="text/javascript">
var djConfig = {
parseOnLoad: true
};
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6">
</script>
<script type="text/javascript">
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.dijit.OverviewMap");
var map;

function init() {
var initExtent = new esri.geometry.Extent({
"xmin":-7413378.648884336,"ymin":1898800.4677371255,"xmax":-7031499.25557178,"ymax":2094785.0082602233,"spatialReference":{"wkid":102100}
});
map = new esri.Map("map",initExtent);

//resize the map when the browser resizes - view the 'Resizing and repositioning the map' section in
//the following help topic for more details http://help.esri.com/EN/webapi/javas...guidelines.htm
var resizeTimer;
dojo.connect(map, 'onLoad', function(theMap) {
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);

//add the overview map
var overviewMapDijit = new esri.dijit.OverviewMap({
map: map
});
overviewMapDijit.startup();
});



oceanBM = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer",{displayLevels:[6,7,8,9]});
map.addLayer(oceanBM);
basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer",{displayLevels:[0,1,2,3,4,5,6]});
map.addLayer(basemap);

//{displayLevels:[10,11,12,13,14,15,16]}





}

dojo.addOnLoad(init);
</script>

</script>
</head>

<body class="claro">
<div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width: 100%; height: 100%; margin:0;">
<div id="map" dojotype="dijit.layout.ContentPane" region="center" style="padding:0">
</div>
</div>
</body>

</html>

Cheers!!

SS
0 Kudos
MikeOnzay
Frequent Contributor
I want it the other way around. When the ocean basemap disappears I want the light canvas map to appear.
0 Kudos
MikeOnzay
Frequent Contributor
The solution was to specify display levels on both of the layers I wanted to use (as the previous user suggested). I also made sure to not use the same level (10) in both layers.

basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer",{displayLevels:[10,11,12,13,14,15,16]});
map.addLayer(basemap); //added this layer so there would be a large number of zoom levels and for overview map

oceanBM = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer",{displayLevels:[0,1,2,3,4,5,6,7,8,9]});
map.addLayer(oceanBM);
0 Kudos