~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/openlayers/examples/KMLParser.html

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>