Hello,
I used the following sample code to load my tiled base map layer and my dynamic map layer.
Both map server have the same projection and same display extents. When the map initially loaded I cannot see both layers and when I pan a little bit, the layers displayed.
Can you help me to fix this problem?
Thank you,
Rachel
********
<!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" />
<title>Create Map</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.6/js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6"></script>
<script type="text/javascript">
dojo.require("esri.map");
function init() {
var map = new esri.Map("map");
//Takes a URL to a non cached map service.
var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer");
map.addLayer(dynamicMapServiceLayer);
var dynlayer2 = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer",{"opacity":0.5});
map.addLayer(dynlayer2);
}
dojo.addOnLoad(init);
</script>
</head>
<body class="tundra">
<div id="map" style="width:900px; height:600px; border:1px solid #000;"></div>
Creates a map and adds an ArcGISDynamicMapServiceLayer.<br />
Map navigation using mouse:
<ul>
<li>Drag to pan</li>
<li>SHIFT + Click to recenter</li>
<li>SHIFT + Drag to zoom in</li>
<li>SHIFT + CTRL + Drag to zoom out</li>
<li>Mouse Scroll Forward to zoom in</li>
<li>Mouse Scroll Backward to zoom out</li>
<li>Use Arrow keys to pan</li>
<li>+ key to zoom in a level</li>
<li>- key to zoom out a level</li>
<li>Double Click to Center and Zoom in</li>
</ul>
</body>
</html>
***
Hello Rachel,
Your code is perfect and working fine. Due to connection issues it will take time to load... wait for 2-3 mins maybe it is taking time to load the map services.
Regards,
Rohit Garg
var initExtent = new esri.geometry.Extent({"xmin":-17731,"ymin":6710077,"xmax":-12495,"ymax":6712279,"spatialReference":{"wkid":102100}}); map = new esri.Map("map",{extent:initExtent});
Hi Rohit,
Thanks for your help.
The code works fine. But I changed the both ArcGISDynamicMapServiceLayers to my own map services.
For once the code loaded both layers well, but I changed the map extents for both maps, it cannot display the map unless I paned the map.
Any ideas?
Rachel