Select to view content in your preferred language

adding wms Layer as a Basemap instead of using arcgis javascript api base maps

3202
2
12-11-2013 09:54 AM
GaneshSolai_Sambandam
Regular Contributor
HI GIS folks
I have an WMS layer which is a cross domain resource and I wanted to embed those layers as basemap in application using JavaScript api rather than using built in ArcGIS Basemaps.

here is the WMS Layer link:


http://geobretagne.fr/geoserver/ref/wms?service=WMS&request=getCapabilities

any help in this regard would be much appreciated.

Thanks
ganesh
0 Kudos
2 Replies
GaneshSolai_Sambandam
Regular Contributor
HI Guys
Could anyone please hlep or throw some insights on this.

Thanks
ganesh
0 Kudos
GaneshSolai_Sambandam
Regular Contributor
Hi GiS folks
Can you anyone help me adding this arcgis.com webmap  below into the arcgis javascript api.
For some reasons, I used the webmapid for this service but, it didn't work.


http://www.arcgis.com/home/item.html?id=536bb8b3c8a9418c938491752231d7f4

My script
[HTML]<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Create web map from id</title>

    <link rel="stylesheet" href="http://js.arcgis.com/3.7/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="http://js.arcgis.com/3.7/js/esri/css/esri.css">
    <link rel="stylesheet" href="css/layout.css">


    <script src="http://js.arcgis.com/3.7/"></script>
    <script>
      require([
        "dojo/parser",
        "dojo/ready",
        "dijit/layout/BorderContainer",
        "dijit/layout/ContentPane",
        "dojo/dom",
        "esri/map", 
        "esri/urlUtils",
        "esri/arcgis/utils",
        "esri/dijit/Legend",
        "esri/dijit/Scalebar",
        "dojo/domReady!"
      ], function(
        parser,
        ready,
        BorderContainer,
        ContentPane,
        dom,
        Map,
        urlUtils,
        arcgisUtils,
        Legend,
        Scalebar
      ) {
        ready(function(){

        parser.parse();


        arcgisUtils.createMap("536bb8b3c8a9418c938491752231d7f4","map").then(function(response){
        

         // dom.byId("title").innerHTML = response.itemInfo.item.title;
        //  dom.byId("subtitle").innerHTML = response.itemInfo.item.snippet;

          var map = response.map;



          //add the scalebar 
          var scalebar = new Scalebar({
            map: map,
            scalebarUnit: "english"
          });

          //add the legend. Note that we use the utility method getLegendLayers to get 
          //the layers to display in the legend from the createMap response.
         // var legendLayers = arcgisUtils.getLegendLayers(response); 
          /*var legendDijit = new Legend({
            map: map,
            layerInfos: legendLayers
          },"legend");
          legendDijit.startup(); */


        });


        });

      });
     
    </script>
  </head>

  <body class="claro">
    <div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%; height:100%;">
      <div id="header" class="shadow roundedCorners" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
        <div id="title"></div>
        <div id="subtitle"></div>
      </div>
      <div id="map" class="roundedCorners shadow" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"></div>
      <div id="rightPane" class="roundedCorners shadow" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'" >
        <div id="legend"></div>
      </div>
    </div>
  </body>
</html>
 
[/HTML]
0 Kudos