]> dev.renevier.net Git - syp.git/blob - openlayers/examples/boxes-vector.html
err_lonlat_invalid exceptions not thrown correctly
[syp.git] / openlayers / examples / boxes-vector.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2     <head>
3         <title>OpenLayers Boxes Example</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         <script type="text/javascript">
8             var box_extents = [
9                 [-10, 50, 5, 60],
10                 [-75, 41, -71, 44],
11                 [-122.6, 37.6, -122.3, 37.9],
12                 [10, 10, 20, 20]
13             ];
14             var map;
15             function init(){
16                 map = new OpenLayers.Map('map');
17
18                 var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
19                     "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
20
21                 var boxes  = new OpenLayers.Layer.Vector( "Boxes" );
22     
23                 for (var i = 0; i < box_extents.length; i++) {
24                     ext = box_extents[i];
25                     bounds = new OpenLayers.Bounds(ext[0], ext[1], ext[2], ext[3]);
26                     
27                     box = new OpenLayers.Feature.Vector(bounds.toGeometry());
28                     boxes.addFeatures(box);
29                 }
30
31                 map.addLayers([ol_wms, boxes]);
32                 map.addControl(new OpenLayers.Control.LayerSwitcher());
33                 var sf = new OpenLayers.Control.SelectFeature(boxes);
34                 map.addControl(sf);
35                 sf.activate();
36                 map.zoomToMaxExtent();
37             }
38         </script>
39     </head>
40     <body onload="init()">
41         <h1 id="title">Boxes Example</h1>
42
43         <div id="tags">
44         </div>
45
46         <p id="shortdesc">
47             Demonstrate marker and box type annotations on a map.
48         </p>
49         
50         <div id="map" class="smallmap"></div>
51
52         <div id="docs"></div>
53     </body>
54 </html>