AnsweredAssumed Answered

Adding a WMSLayer using ESRI JavaScript 3.10 API

Question asked by ttam on Sep 3, 2014
Latest reply on Sep 4, 2014 by ttam

Hi,

 

I have a very simple question. I have a WMS serving a British National Grid Map. I onnly need that layer to be displayed. I have so far failed to get this to display.

 

The code I am using is shown below

 

<!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"/>

   <title>Simple Map</title>

  <link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css">

  <script src="http://js.arcgis.com/3.10/"></script>

   <script type="text/javascript">

    alert ("-1");
   dojo.require("esri.map");

  function init() {
  var myMap = new esri.Map("mapDiv");
  //note that if you do not have public Internet access then you will need to point this url to your own locally accessible cached service.

  var wmsLayer = new esri.layers.WMSLayer("http://localhost:6080/arcgis/services/test/MapServer/WMSServer");

  myMap.addLayer(wmsLayer);

  }

alert ("0");
  dojo.addOnLoad(init);
alert ("1");

  
</script>


 
</head>


 
<body class="tundra">

   <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div>


 
</body>


</html>

 

I am new to the ESRI JavaScript API so would appreciate any help. BTW I can view the map in GeoExplorer so I know the service is working.

 

Many thanks

 

Tuckers

Outcomes