]> dev.renevier.net Git - syp.git/blob - openlayers/examples/KMLParser.html
removes unused openlayers files in build result
[syp.git] / openlayers / examples / KMLParser.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2   <head>
3     <title>OpenLayers KML Parser Example</title>
4     <link rel="stylesheet" href="style.css" type="text/css" />
5     <script src="../lib/OpenLayers.js"></script>
6     <script type="text/javascript">
7         function parseData(req) {
8           g =  new OpenLayers.Format.KML({extractStyles: true});
9           html = ""
10           features = g.read(req.responseText);
11           for(var feat in features) {
12             html += "Feature: Geometry: "+ features[feat].geometry+",";
13                 html += "<ul>";
14             for (var j in features[feat].attributes) {
15                 html += "<li>Attribute "+j+":"+features[feat].attributes[j]+"</li>";
16             }
17                 html += "</ul>"
18                 html += "<ul>";
19             for (var j in features[feat].style) {
20                 html += "<li>Style "+j+":"+features[feat].style[j]+"</li>";
21             }
22                 html += "</ul>"
23           }
24           document.getElementById('output').innerHTML = html;
25         }
26         function load() {
27             OpenLayers.loadURL("kml/lines.kml", "", null, parseData);
28         }
29     </script>
30   </head>
31   <body onload="load()">
32       <h1 id="title">KML Parser Example</h1>
33
34       <div id="tags"></div>
35
36       <p id="shortdesc">
37           Demonstrate the operation of the KML parser.
38       </p>
39
40       <div id="output"></div>
41
42       <div id="docs">
43           This script reads data from a KML file and parses out the coordinates, appending them to a HTML string with markup tags.
44           This markup is dumped to an element in the page.
45     </div>
46   </body>
47 </html>