]> dev.renevier.net Git - syp.git/blob - openlayers/examples/getfeatureinfo.html
initial commit
[syp.git] / openlayers / examples / getfeatureinfo.html
1 <html>
2   <head>
3     <title>OpenLayers Feature Info Example</title>
4     <script src="../lib/OpenLayers.js"></script>
5     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
6     <link rel="stylesheet" href="style.css" type="text/css" />
7     <style type="text/css">
8         ul, li { padding-left: 0px; margin-left: 0px; }
9     </style>
10   </head>
11   <body>
12       <h1 id="title">Feature Info Example</h1>
13
14       <div id="tags"></div>
15
16       <p id="shortdesc">
17         Demonstrates sending a GetFeatureInfo query to an OWS. Returns information about a map feature in the side DIV.
18       </p>
19
20     <a id="permalink" href="">Permalink</a><br />
21
22     <div style="float:right;width:28%">
23         <h1 style="font-size:1.3em;">CIA Factbook</h1>
24         <p style="font-size:.8em;">Click a country to see statistics about the country below.</p>
25         <div id="nodeList">
26         </div>
27     </div>
28       <div id="map" class="smallmap"></div>
29
30   <script defer="defer" type="text/javascript">
31     OpenLayers.ProxyHost = "/dev/examples/proxy.cgi?url=";
32     var map = new OpenLayers.Map('map', {'maxResolution':'auto'});
33
34     var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
35         "http://world.freemap.in/cgi-bin/mapserv?map=/www/freemap.in/world/map/factbook.map", {'layers': 'factbook'} );
36     map.addLayer(wms);
37     map.addControl(new OpenLayers.Control.Permalink('permalink'));
38     map.zoomToMaxExtent();
39     map.events.register('click', map, function (e) {
40             OpenLayers.Util.getElement('nodeList').innerHTML = "Loading... please wait...";
41             var url =  wms.getFullRequestString({
42                             REQUEST: "GetFeatureInfo",
43                             EXCEPTIONS: "application/vnd.ogc.se_xml",
44                             BBOX: wms.map.getExtent().toBBOX(),
45                             X: e.xy.x,
46                             Y: e.xy.y,
47                             INFO_FORMAT: 'text/html',
48                             QUERY_LAYERS: wms.params.LAYERS,
49                             WIDTH: wms.map.size.w,
50                             HEIGHT: wms.map.size.h});
51             OpenLayers.loadURL(url, '', this, setHTML);
52             OpenLayers.Event.stop(e);
53       });
54     function setHTML(response) {
55         OpenLayers.Util.getElement('nodeList').innerHTML = response.responseText;
56     }
57   </script>
58
59     <div id="docs">
60     </div>
61   </body>
62 </html>