Adding a Map(Local)

782
5
06-27-2011 03:12 AM
asifmohammed
New Contributor
<!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"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <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 myMap = new esri.Map("mapDiv");

        var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://stc7c7/ArcGIS/services/fdtcoverage/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>
------------------

hi, am new ArcGIS Javascript API,
i need to display a local map through javascript API,
my service name : fdtcoverage(http://stc7c7/ArcGIS/services/fdtcoverage/MapServer),

when i run the html page, no map is displaying,
can somebody guide me, how to do ?
0 Kudos
5 Replies
derekswingley1
Frequent Contributor
First, I would recommend starting with a sample that uses the latest version of the API:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/map_dynamic.html

Next, it looks like you need a class="tundra" attribute on your body tag. Also make sure you're using the proper layer type for you map service. Is your local service tiled/cached? If it's not, you need to use ArcGISDynamicMapServiceLayer(), not ArcGISTiledMapServiceLayer().
0 Kudos
asifmohammed
New Contributor
First, I would recommend starting with a sample that uses the latest version of the API:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/map_dynamic.html

Next, it looks like you need a class="tundra" attribute on your body tag. Also make sure you're using the proper layer type for you map service. Is your local service tiled/cached? If it's not, you need to use ArcGISDynamicMapServiceLayer(), not ArcGISTiledMapServiceLayer().


i got the following error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Mon, 27 Jun 2011 16:20:19 UTC


Message: Syntax error
Line: 1
Char: 1
Code: 0
URI: http://lt7c7/ArcGIS/services/COVERAGE/MapServer? f=json&dpi=96&transparent=true&format=png8&callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback
0 Kudos
derekswingley1
Frequent Contributor
What did you change that resulted in this error? Does it work if you take a simple sample from the help, put in your map service URL and load the modified sample in a browser?
0 Kudos
nicogis
MVP Frequent Contributor
client use rest services (add rest between your name instance arcgis and services)

http://lt7c7/ArcGIS/rest/services/COVERAGE/Mapserver
0 Kudos
derekswingley1
Frequent Contributor
Nice catch, Domenico!
0 Kudos