Updated example to use a simpler dataset with data from a maintained

demo server. Thanks dwins for putting this together.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@9250 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-04-09 12:57:31 +00:00
parent 2b7e8f5198
commit 3222fd3618
+19 -25
View File
@@ -14,59 +14,53 @@
function load() { function load() {
map = new OpenLayers.Map('map', { map = new OpenLayers.Map('map', {
maxExtent: new OpenLayers.Bounds(16.154,-34.953,33.327,-22.193) maxExtent: new OpenLayers.Bounds(143.834,-43.648,148.479,-39.573)
}); });
var roads = new OpenLayers.Layer.WMS("Roads", var roads = new OpenLayers.Layer.WMS("State Boundaries",
"http://geo.openplans.org/geoserver/wms", "http://demo.opengeo.org/geoserver/wms",
{'layers': 'za:za_roads', transparent: true, format: 'image/png'}, {'layers': 'topp:tasmania_state_boundaries', transparent: true, format: 'image/png'},
{isBaseLayer: true} {isBaseLayer: true}
); );
var natural = new OpenLayers.Layer.WMS("Natural Features", var natural = new OpenLayers.Layer.WMS("Roads",
"http://geo.openplans.org/geoserver/wms", "http://demo.opengeo.org/geoserver/wms",
{'layers': 'za:za_natural', transparent: true, format: 'image/png'}, {'layers': 'topp:tasmania_roads', transparent: true, format: 'image/png'},
{isBaseLayer: false} {isBaseLayer: false}
); );
var points = new OpenLayers.Layer.WMS("Points of Interest", var points = new OpenLayers.Layer.WMS("Cities",
"http://geo.openplans.org/geoserver/wms", "http://demo.opengeo.org/geoserver/wms",
{'layers': 'za:za_points', transparent: true, format: 'image/png'}, {'layers': 'topp:tasmania_cities', transparent: true, format: 'image/png'},
{isBaseLayer: false} {isBaseLayer: false}
); );
vegetation = new OpenLayers.Layer.WMS("Vegetation", vegetation = new OpenLayers.Layer.WMS("Bodies of Water",
"http://geo.openplans.org/geoserver/wms", "http://demo.opengeo.org/geoserver/wms",
{'layers': 'za:za_vegetation', transparent: true, format: 'image/png'}, {'layers': 'topp:tasmania_water_bodies', transparent: true, format: 'image/png'},
{isBaseLayer: false} {isBaseLayer: false}
); );
highlightLayer = new OpenLayers.Layer.Vector("Highlighted Features", { highlightLayer = new OpenLayers.Layer.Vector("Highlighted Features", {
displayInLayerSwitcher: false, displayInLayerSwitcher: false,
isBaseLayer: false, isBaseLayer: false
styleMap: new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
fillColor: "#0000BB",
strokeColor: "#000099"
})
})
} }
); );
infoControls = { infoControls = {
click: new OpenLayers.Control.WMSGetFeatureInfo('http://geo.openplans.org/geoserver/wms', { click: new OpenLayers.Control.WMSGetFeatureInfo('http://demo.opengeo.org/geoserver/wms', {
title: 'Identify features by clicking', title: 'Identify features by clicking',
layers: [vegetation], layers: [vegetation],
queryVisible: true queryVisible: true
}), }),
hover: new OpenLayers.Control.WMSGetFeatureInfo('http://geo.openplans.org/geoserver/wms', { hover: new OpenLayers.Control.WMSGetFeatureInfo('http://demo.opengeo.org/geoserver/wms', {
title: 'Identify features by clicking', title: 'Identify features by clicking',
layers: [vegetation], layers: [vegetation],
hover: true, hover: true,
// defining a custom format here // defining a custom format here
formats: {'application/vnd.ogc.gml': new OpenLayers.Format.GML({ formats: {'application/vnd.ogc.gml': new OpenLayers.Format.GML({
typeName: 'vegetation', typeName: 'water_bodies',
featureNS: 'http://opengeo.org/za' featureNS: 'http://www.openplans.org/topp'
})}, })},
queryVisible: true queryVisible: true
}) })
@@ -138,7 +132,7 @@
<a id="permalink" href="">Permalink</a><br /> <a id="permalink" href="">Permalink</a><br />
<div style="float:right;width:28%"> <div style="float:right;width:28%">
<h1 style="font-size:1.3em;">South Africa</h1> <h1 style="font-size:1.3em;">Tasmania</h1>
<p style="font-size:.8em;">Click on the map to get feature info.</p> <p style="font-size:.8em;">Click on the map to get feature info.</p>
<div id="nodeList"> <div id="nodeList">
</div> </div>