OpenLayers OpenLayers

root/branches/openlayers/2.5/examples/KMLParser.html

Revision 4322, 1.0 kB (checked in by crschmidt, 1 year ago)

Remove MetaCarta KML from the repository, and show the KMLParser example with
kml/lines.kml instead.

  • Property svn:eol-style set to native
Line 
1 <html xmlns="http://www.w3.org/1999/xhtml">
2   <head>
3     <style type="text/css">
4         #map {
5             width: 800px;
6             height: 475px;
7             border: 1px solid black;
8         }
9     </style>
10     <script src="../lib/OpenLayers.js"></script>
11     <script type="text/javascript">
12         function parseData(req) {
13           g =  new OpenLayers.Format.KML();
14           html = ""
15           features = g.read(req.responseText);
16           for(var feat in features) {
17             html += "Feature: Geometry: "+ features[feat].geometry+",";
18                 html += "<ul>";
19             for (var j in features[feat].attributes) {
20                 html += "<li>"+j+":"+features[feat].attributes[j]+"</li>";
21             }
22                 html += "</ul>"
23           }
24           document.body.innerHTML = html;
25         }
26         function load() {
27             OpenLayers.loadURL("kml/lines.kml", "", null, parseData);
28         }   
29     </script>
30   </head>
31   <body onload="load()">
32   </body>
33 </html> 
Note: See TracBrowser for help on using the browser.