]> dev.renevier.net Git - syp.git/blob - openlayers/examples/all-overlays.html
initial commit
[syp.git] / openlayers / examples / all-overlays.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2     <head>
3         <title>All Overlays Example</title>
4         
5         <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
6         <link rel="stylesheet" href="style.css" type="text/css" />
7         <script src="../lib/OpenLayers.js"></script>
8         <script type="text/javascript">
9             var map;
10             function init() {
11                 map = new OpenLayers.Map({
12                     div: "map",
13                     allOverlays: true,
14                     maxExtent: new OpenLayers.Bounds(
15                         1549471.9221, 6403610.94, 1550001.32545, 6404015.8
16                     )
17                 });
18
19                 // give the features some style
20                 var styles = new OpenLayers.StyleMap({
21                     "default": {
22                         strokeWidth: 2
23                     },
24                     "select": {
25                         strokeColor: "#0099cc",
26                         strokeWidth: 4
27                     }
28                 });
29             
30                 // add rules from the above lookup table
31                 styles.addUniqueValueRules("default", "RP_TYPE", {
32                     10: {strokeColor: "#000000", strokeWidth: 2},
33                     12: {strokeColor: "#222222", strokeWidth: 2},
34                     14: {strokeColor: "#444444", strokeWidth: 2},
35                     16: {strokeColor: "#666666", strokeWidth: 2},
36                     18: {strokeColor: "#888888", strokeWidth: 2},
37                     19: {strokeColor: "#666666", strokeWidth: 1}
38                 });
39
40                 var vectors = new OpenLayers.Layer.Vector("Lines", {
41                     strategies: [new OpenLayers.Strategy.Fixed()],                
42                     protocol: new OpenLayers.Protocol.HTTP({
43                         url: "data/roads.json",
44                         format: new OpenLayers.Format.GeoJSON()
45                     }),
46                     styleMap: styles
47                 });
48             
49                 map.addLayer(vectors);
50                 map.addControl(new OpenLayers.Control.LayerSwitcher());
51                 map.zoomToMaxExtent();
52
53             }            
54
55         </script>
56     </head>
57     <body onload="init()">
58         <h1 id="title">OpenLayers Overlays Only Example</h1>
59         <p id="shortdesc">
60             Demonstrates a map with overlays only.
61         </p>
62         <div id="map" class="smallmap"></div>    
63         <div id="docs">
64             To create a map that allows any draw order with all layer types
65             and lets you set the visibility of any layer independently, set
66             the allOverlays property on the map to true.
67         </div>
68     </body>
69 </html>