danoski74

Cannot view WMSLayer nwhen basemap set

Discussion created by danoski74 on May 22, 2014
Latest reply on Jun 14, 2016 by PavelVeselsky
I have found that if my map object has a basemap property set then the WMSLayer does not display when retrieving by resourceInfo method. When I do not set the basemap property then the WMSLayer is displayed.

This is not very useful as I need to see the basemap. I dont know if this is a bug or me, I have no solution at the moment so any help greatly appreciated.

Here is the url 'http://npdwms.npd.no/NPD_FactMap.asp' and layer is 'Quadrants'

I tried setting the visibility to no avail.

I do not have this problem when retrieving by proxy method but I would rather use the resourceInfo method

Here is my code


<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!--The viewport meta tag is used to improve the presentation and behavior of the samples
       on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Map with WMS</title>

    <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
    <style>
        html, body, #map {
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
        }
        body {
            background-color: #FFF;
            overflow: hidden;
            font-family: "Trebuchet MS";
        }
    </style>
    <script src="http://js.arcgis.com/3.9/"></script>

    <script>
        var map;

        require(["esri/map", "esri/layers/WMSLayer", "esri/config","esri/layers/WMSLayerInfo","esri/geometry/Extent","esri/layers/FeatureLayer"],
                function(Map, WMSLayer, esriConfig, WMSLayerInfo,Extent,FeatureLayer,parser) {

                    map = new Map("map", {
                      extent: new Extent({xmin:-8.64846,ymin:49.8638,xmax:1.76767,ymax:60.8612,spatialReference:{wkid:4326}}),
                        zoom: 2,
                        // basemap: "streets"
                    });

                    addNorway(WMSLayer,WMSLayerInfo,Extent);
                    addBGS(WMSLayer,WMSLayerInfo,Extent);
                });



        function addBGS(WMSLayer,WMSLayerInfo,Extent){
            var layer20 = new WMSLayerInfo({name:"GBR_BGS_625k_BLS",title:"GBR BGS 1:625k Bedrock Lithology"});

            var resourceInfo20 = {
                extent: new Extent(-8.64846,49.8638,1.76767,60.8612,{wkid: 4326}),
                layerInfos: []
            };
            var wmsLayer20 = new WMSLayer("http://ogc.bgs.ac.uk/cgi-bin/BGS_Bedrock_and_Superficial_Geology/wms",
                    {
                        resourceInfo: resourceInfo20,
                        visibleLayers: ["GBR_BGS_625k_BLS"]
                    }
            );
            map.addLayers([wmsLayer20]);
            wmsLayer20.setVisibility(true);

        }

        function addNorway(WMSLayer,WMSLayerInfo,Extent){
            var layer10 = new WMSLayerInfo({name:"Quadrants",title:"NO Quads"});

            var resourceInfo10 = {
                extent: new Extent(-10.0,50.0,20.0,65.0,{wkid: 4326}),
                layerInfos: [layer10],
                version:"1.1.1"
            };
            var wmsLayer10 = new WMSLayer("http://npdwms.npd.no/NPD_FactMap.asp",
                    {resourceInfo: resourceInfo10,
                        visibleLayers: ["Quadrants","pl_all","Fields","Exploration","Development"]
                    }
            );

            map.addLayers([wmsLayer10]);
 
        }


    </script>
</head>

<body>
<div id="map">
</div>
</body>
</html>

Outcomes