Select to view content in your preferred language

Question about adding WMS layer to a webpage...

674
0
01-25-2013 08:37 AM
JeremySears
New Contributor
Hello,
Im having issues adding a wms to a webpage.

I have followed the tutorial here.

I can get this working in my browser.

My issue happens when I attempt to add a different wms. I am attempting to add this service:

http://geoviewer.inac.gc.ca/gisprd3/services/THM_ABORIGINAL_E/MapServer/WMSServer

The issue is that I can not see any data or layers when I use this wms.

I believe that this wms has a few layers in it and the wms used in the tutorial posted above uses a simple service. I think I need to specify what layers Id like to pull out to display on the webpage.

Im hoping someone could point me to a tutorial or documentation on how to use javascript to specify the layers I want to display. Or perhaps suggest a way for me to use the WMS in my webpage.

Here is the code I am currently using. I get a blank map window in the page when rendered by my browser.


[PHP]<!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");
  // original code, this works fine
 
 
      //  var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer");
      //  myMap.addLayer(myTiledMapServiceLayer);
 
 
  // Ive swapped the url of the example WMS with the url of our WMS, but all that is drawn in my browser is an empty map window.
  // need to specify what layer(s) I want to pull from this service?
 
        var OurData = new esri.layers.ArcGISTiledMapServiceLayer("http://swihqokgis64b/GISPRD3/services/THM_ABORIGINAL_E/MapServer/WMSServer");
        myMap.addLayer(OurData); 
 
 
      }

      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>[/PHP]

Thanks!
0 Kudos
0 Replies