|
Revision 7095, 1.4 kB
(checked in by tschaub, 4 months ago)
|
giving examples some style
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 2 |
<head> |
|---|
| 3 |
<title>OpenLayers GML Parser</title> |
|---|
| 4 |
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" /> |
|---|
| 5 |
<link rel="stylesheet" href="style.css" type="text/css" /> |
|---|
| 6 |
<script src="../lib/OpenLayers.js"></script> |
|---|
| 7 |
<script type="text/javascript"> |
|---|
| 8 |
function parseData(req) { |
|---|
| 9 |
g = new OpenLayers.Format.GML(); |
|---|
| 10 |
html = "" |
|---|
| 11 |
features = g.read(req.responseText); |
|---|
| 12 |
for(var feat in features) { |
|---|
| 13 |
html += "Feature: Geometry: "+ features[feat].geometry+","; |
|---|
| 14 |
html += "<ul>"; |
|---|
| 15 |
for (var j in features[feat].attributes) { |
|---|
| 16 |
html += "<li>"+j+":"+features[feat].attributes[j]+"</li>"; |
|---|
| 17 |
} |
|---|
| 18 |
html += "</ul>" |
|---|
| 19 |
} |
|---|
| 20 |
document.getElementById('output').innerHTML = html; |
|---|
| 21 |
} |
|---|
| 22 |
function load() { |
|---|
| 23 |
OpenLayers.loadURL("gml/owls.xml", "", null, parseData); |
|---|
| 24 |
} |
|---|
| 25 |
</script> |
|---|
| 26 |
</head> |
|---|
| 27 |
<body onload="load()"> |
|---|
| 28 |
<h1 id="title">GML Parser Example</h1> |
|---|
| 29 |
|
|---|
| 30 |
<div id="tags"></div> |
|---|
| 31 |
|
|---|
| 32 |
<p id="shortdesc"> |
|---|
| 33 |
Demonstrate the operation of the GML parser. |
|---|
| 34 |
</p> |
|---|
| 35 |
|
|---|
| 36 |
<div id="output"></div> |
|---|
| 37 |
|
|---|
| 38 |
<div id="docs"> |
|---|
| 39 |
This script reads data from a GML file and parses out the coordinates, appending them to a HTML string with markup tags. |
|---|
| 40 |
This markup is dumped to an element in the page. |
|---|
| 41 |
</div> |
|---|
| 42 |
</body> |
|---|
| 43 |
</html> |
|---|