Select to view content in your preferred language

Map doesn't displayed

847
4
08-18-2010 12:55 PM
AlejandroMorales
Emerging Contributor
Hi, I'm wondering if anyone has had this problem, I'm using JavaScript API to display a simple map but when I run the appy the browser doesn't display anything :S it's like the map doesn't exist :S
here is my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Create a Map</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <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");

        var myMap, myTiledMapServiceLayer;
        function init() {
            myMap = new esri.Map("mapDiv");

           //myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer");
            myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://servarcgisprd/arcgis/rest/services/Demo_001/MapServer");
                  
            myMap.addLayer(myTiledMapServiceLayer);
        }

        dojo.addOnLoad(init);
    </script>
  </head>
  <body>
    <div id="mapDiv" class="tundra" style="width:900px; height:600px; border:1px solid #000;"></div>
    <h4>Work flow:</h4>
<ul>
<li>Create a map.</li>
<li>Add an ArcGISTiledMapServiceLayer.</li>
</ul>
  </body>
</html>

Please If You know the answer help me!
thanks in advanced
0 Kudos
4 Replies
derekswingley1
Deactivated User
That code looks fine. I would say your problem is with your map service if nothing displays when you load your page. Are you able to view your service using the JavaScript preview from the services directory? The url should be http://servarcgisprd/arcgis/rest/services/Demo_001/MapServer?f=jsapi
0 Kudos
AlejandroMorales
Emerging Contributor
That code looks fine. I would say your problem is with your map service if nothing displays when you load your page. Are you able to view your service using the JavaScript preview from the services directory? The url should be http://servarcgisprd/arcgis/rest/services/Demo_001/MapServer?f=jsapi


Thank you so much for your response I do view the service using the JavaScript preview from the services directory...
Please, Any other ideas ? 
Someone I work with said that the problem was the browser options in the in the "load images automatically" options but I'm not that sure about that...
0 Kudos
BenStuder
Deactivated User
Thank you so much for your response I do view the service using the JavaScript preview from the services directory...
Please, Any other ideas ? 
Someone I work with said that the problem was the browser options in the in the "load images automatically" options but I'm not that sure about that...



Can you browse to "http://servarcgisprd" directly?
0 Kudos
AlejandroMorales
Emerging Contributor
I found out what the problem was I browse:
http://servarcgisprd/ArcGIS/rest/services/Demo_001/MapServer

and look at
"Single Fused Map Cache: false"

someone I know told me that when single fused map cache is false you have to use:
"new esri.layers.ArcGISDynamicMapServiceLayer(..."
instead of:

"new esri.layers.ArcGISTiledMapServiceLayer(..."

I try that and It worked out!
thank you for your help!

Ale
0 Kudos