| 1 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 2 |
<head> |
|---|
| 3 |
<title>OpenLayers GeoRSS Example</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 |
var map, layer; |
|---|
| 9 |
|
|---|
| 10 |
OpenLayers.ProxyHost = "/proxy/?url="; |
|---|
| 11 |
function init(){ |
|---|
| 12 |
map = new OpenLayers.Map('map', {maxResolution:'auto'}); |
|---|
| 13 |
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", |
|---|
| 14 |
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); |
|---|
| 15 |
map.addLayer(layer); |
|---|
| 16 |
map.setCenter(new OpenLayers.LonLat(0, 0), 0); |
|---|
| 17 |
map.addControl(new OpenLayers.Control.LayerSwitcher()); |
|---|
| 18 |
} |
|---|
| 19 |
function addUrl() { |
|---|
| 20 |
var urlObj = OpenLayers.Util.getElement('url'); |
|---|
| 21 |
var value = urlObj.value; |
|---|
| 22 |
var parts = value.split("/"); |
|---|
| 23 |
var newl = new OpenLayers.Layer.GeoRSS( parts[parts.length-1], value); |
|---|
| 24 |
map.addLayer(newl); |
|---|
| 25 |
urlObj.value = ""; |
|---|
| 26 |
} |
|---|
| 27 |
</script> |
|---|
| 28 |
</head> |
|---|
| 29 |
<body onload="init()"> |
|---|
| 30 |
<h1 id="title">GeoRSS Example</h1> |
|---|
| 31 |
|
|---|
| 32 |
<div id="tags"></div> |
|---|
| 33 |
|
|---|
| 34 |
<p id="shortdesc"> |
|---|
| 35 |
Display a couple of locally cached georss feeds on an a basemap. |
|---|
| 36 |
</p> |
|---|
| 37 |
|
|---|
| 38 |
<div id="map" class="smallmap"></div> |
|---|
| 39 |
|
|---|
| 40 |
<div id="docs"> |
|---|
| 41 |
<p>This demo uses the OpenLayers GeoRSS parser, which supports GeoRSS Simple and W3C GeoRSS. Only points are |
|---|
| 42 |
currently supported. The OpenLayers GeoRSS parser will automatically connect an information bubble to the map |
|---|
| 43 |
markers, similar to Google maps. In addition, the parser can use custom PNG icons for markers. A sample GeoRSS |
|---|
| 44 |
file (georss.xml) is included. |
|---|
| 45 |
|
|---|
| 46 |
<form onsubmit="return false;"> |
|---|
| 47 |
GeoRSS URL: <input type="text" id="url" size="50" value="georss.xml" /> |
|---|
| 48 |
<input type="submit" onclick="addUrl(); return false;" value="Load Feed" onsubmit="addUrl(); return false;" /> |
|---|
| 49 |
</form> |
|---|
| 50 |
|
|---|
| 51 |
<p>The above input box allows the input of a URL to a GeoRSS feed. This feed can be local to the HTML page -- |
|---|
| 52 |
for example, entering 'georss.xml' will work by default, because there is a local file in the directory called |
|---|
| 53 |
georss.xml -- or, with a properly set up ProxyHost variable (as is used here), it will be able to load any |
|---|
| 54 |
HTTP URL which contains GeoRSS and display it. Anything else will simply have no effect.</p> |
|---|
| 55 |
</div> |
|---|
| 56 |
</body> |
|---|
| 57 |
</html> |
|---|