wmst.html 1.57 KB
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <style type="text/css">
        #map {
            width: 512px;
            height: 400px;
            border: 1px solid black;
        }
    </style>
    <script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
        <!--
var map,ia_wms;
        function init(){
            map = new OpenLayers.Map('map');

            var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
                "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );

            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
                "http://wms.jpl.nasa.gov/wms.cgi", 
                {layers: "modis,global_mosaic"});

            ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:OpenLayers.Util.getElement('time').value});

            jpl_wms.setVisibility(false);

            map.addLayers([ol_wms, jpl_wms, ia_wms]);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.zoomToMaxExtent();
        }
        // -->
    </script>
  </head>
  <body onload="init()">
    <h1>OpenLayers Example</h1>
    <p>WMS-T example: update the times, and the radar image will change. Uses Layer.changeParams. Thanks to David Bitner for the inspiration, the original code, and the kick in the butt!</p>
    <input type='text' id='time'  value="2005-08-29T13:00:00Z" onChange='ia_wms.mergeNewParams({"time":this.value});' >
    <div id="map"></div>
  </body>
</html>