]> dev.renevier.net Git - syp.git/blob - openlayers/examples/setextent.html
initial commit
[syp.git] / openlayers / examples / setextent.html
1 <html>
2 <head>
3 <title>Setting a visual Extent</title>
4 <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
5     <link rel="stylesheet" href="style.css" type="text/css" />
6 <script src="../lib/OpenLayers.js"></script>
7 </head>
8 <body>
9 <h1 id="title">Setting a Visual Extent</h1>
10 <p id='shortdesc'>
11   Use a boxes layer to visually display the area of interest indicated by a user.
12 </p>
13 <p>
14   Because the ability to set the map to a given extent is limited by the 
15   current resolutions available, zoomToExtent will not always set the map to 
16   exactly the right extent. In order to visually annotate the actual extent, 
17   this example, will use the Boxes layer to visually describe the desired
18   extent as well as setting the map extent.
19 </p>
20   <div style="width:100%; height:75%" id="map"></div>
21   <script defer="defer" type="text/javascript">
22     var map = new OpenLayers.Map('map');
23     var bounds = new OpenLayers.Bounds(-45,-45, 0, 45); 
24     var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
25         "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
26     map.addLayer(wms);
27     map.zoomToExtent(bounds);
28     var boxes = new OpenLayers.Layer.Boxes("boxes");
29     var box = new OpenLayers.Marker.Box(bounds);
30     boxes.addMarker(box);
31     map.addLayer(boxes);
32   </script>
33 </body>
34 </html>