apps/web-app-template/app.js
/**
         * Add a WMS layer to the globe and applies options object properties to the 
         * the layer.
         * @param {String} serviceAddress Service address for the WMS map server
         * @param {String} layerName Layer name (not title) as defined in the capabilities document
         * @param {Object|null} options
         */
Add a WMS layer to the globe and applies options object properties to the
the layer.
@param {String} serviceAddress Service address for the WMS map server
@param {String} layerName Layer name (not title) as defined in the capabilities document
@param {Object|null} options
Add a WMS layer to the globe and applies options object properties to the the layer . @param { String } serviceAddress Service address for the WMS map server @param { String } layerName Layer name ( not title ) as defined in the capabilities document @param { Object|null } options
addLayerFromWms(serviceAddress, layerName, options) {
            const self = this;
            let url = serviceAddress.split('?')[0];
            url += "?service=wms";
            url += "&request=getcapabilities";
            let parseCapabilities = function (xml) {
                var wmsCapabilities = new WorldWind.WmsCapabilities(xml);
                var layerForDisplay = wmsCapabilities.getNamedLayer(layerName);
                var layerConfig = WorldWind.WmsLayer.formLayerConfiguration(layerForDisplay);
                var wmsLayer = new WorldWind.WmsLayer(layerConfig);
                options.bbox = layerConfig.sector;
                self.addLayer(wmsLayer, options);
            };
            let xhr = new XMLHttpRequest();
            xhr.open("GET", url, true); 
            xhr.onreadystatechange = function () {
                if (xhr.readyState === XMLHttpRequest.DONE) {
                    if (xhr.status === 200) {
                        parseCapabilities(xhr.responseXML);
                    } else {
                        alert("XMLHttpRequest to " + url + " failed with status code " + xhr.status);
                    }
                }
            };
            xhr.send();
        }
addLayerFromWms ( serviceAddress , layerName , options ) { const self = this ; let url = serviceAddress . split ( '?' ) [ 0 ] ; url += "?service=wms" ; url += "&request=getcapabilities" ; let parseCapabilities = function ( xml ) { var wmsCapabilities = new WorldWind . WmsCapabilities ( xml ) ; var layerForDisplay = wmsCapabilities . getNamedLayer ( layerName ) ; var layerConfig = WorldWind . WmsLayer . formLayerConfiguration ( layerForDisplay ) ; var wmsLayer = new WorldWind . WmsLayer ( layerConfig ) ; options . bbox = layerConfig . sector ; self . addLayer ( wmsLayer , options ) ; } ; let xhr = new XMLHttpRequest ( ) ; xhr . open ( "GET" , url , true ) ; xhr . onreadystatechange = function ( ) { if ( xhr . readyState === XMLHttpRequest . DONE ) { if ( xhr . status === 200 ) { parseCapabilities ( xhr . responseXML ) ; } else { alert ( "XMLHttpRequest to " + url + " failed with status code " + xhr . status ) ; } } } ; xhr . send ( ) ; }
Add a WMS layer to the globe and applies options object properties to the
 the layer.
Add a WMS layer to the globe and applies options object properties to the the layer .
// Create a GetCapabilities request URL // Create a WmsCapabilities object from the returned xml // Create the layer and add it to the globe // Extract the bbox out of the WMS layer configuration // Add the layer to the globe // Create a request to retrieve the data // performing an asynchronous request 