git-svn-id: http://svn.openlayers.org/trunk/openlayers@4316 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
43 lines
2.1 KiB
HTML
43 lines
2.1 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<style type="text/css">
|
|
#map {
|
|
width: 800px;
|
|
height: 400px;
|
|
border: 1px solid black;
|
|
}
|
|
</style>
|
|
<script src="../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript">
|
|
var map, layer;
|
|
|
|
OpenLayers.ProxyHost = "/proxy/?url=";
|
|
function init(){
|
|
map = new OpenLayers.Map('map', {maxResolution:'auto'});
|
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
|
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
|
map.addLayer(layer);
|
|
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
|
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
|
}
|
|
function addUrl() {
|
|
var urlObj = OpenLayers.Util.getElement('url');
|
|
var value = urlObj.value;
|
|
var parts = value.split("/");
|
|
var newl = new OpenLayers.Layer.GeoRSS( parts[parts.length-1], value);
|
|
map.addLayer(newl);
|
|
urlObj.value = "";
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="init()">
|
|
<h1>GeoRSS in OpenLayers</h1>
|
|
<p style="font-size:.9em;">This demo uses the OpenLayers GeoRSS parser, which supports GeoRSS Simple and W3C GeoRSS. Only points are currently supported. <a href="http://trac.openlayers.org/wiki/HowToDownload">Get the code!</a></p>
|
|
<form onsubmit="return false;">
|
|
GeoRSS URL: <input type="text" id="url" size="50" /><input type="submit" onclick="addUrl(); return false;" value="Load Feed" onsubmit="addUrl(); return false;" />
|
|
</form>
|
|
<p>The above input box allows the input of a URL to a GeoRSS feed. This feed can be local to the HTML page -- for example, entering 'georss.xml' will work by default, because there is a local file in the directory called georss.xml -- or, with a properly set up ProxyHost variable (as is used here), it will be able to load any HTTP URL which contains GeoRSS and display it. Anything else will simply have no effect.</p>
|
|
<div id="map"></div>
|
|
</body>
|
|
</html>
|