Project

General

Profile

1 3032 perry
<html xmlns="http://www.w3.org/1999/xhtml">
2
  <head>
3
    <style type="text/css">
4
        #map {
5
            width: 512px;
6
            height: 512px;
7
            border: 1px solid black;
8
        }
9
    </style>
10
    <script src="../lib/OpenLayers.js"></script>
11
    <script type="text/javascript">
12
        <!--
13
        function init(){
14
            var map = new OpenLayers.Map('map');
15
16
            var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
17
                "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
18
19
            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
20
                "http://wms.jpl.nasa.gov/wms.cgi",
21
                {layers: "modis,global_mosaic"});
22
23
            jpl_wms.setVisibility(false);
24
25
            map.addLayers([ol_wms, jpl_wms]);
26
            map.addControl(new OpenLayers.Control.LayerSwitcher());
27
            // map.setCenter(new OpenLayers.LonLat(0, 0), 0);
28
            map.zoomToMaxExtent();
29
            map.events.register("click", map, function(e) {
30
                var lonlat = map.getLonLatFromViewPortPx(e.xy);
31
                alert("You clicked near " + lonlat.lat + " N, " +
32
                                          + lonlat.lon + " E");
33
            });
34
        }
35
        // -->
36
    </script>
37
  </head>
38
  <body onload="init()">
39
    <h1>OpenLayers Example</h1>
40
    <div id="map"></div>
41
  </body>
42
</html>