-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathlayers.js
63 lines (49 loc) · 2.08 KB
/
layers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function addLayers(map) {
///////////////////////////////////////////
// setup the custom wms layer
///////////////////////////////////////////
var wmsUrl = "wms";
var layer1 = new OpenLayers.Layer.WMS( "Custom WMS Layer",
wmsUrl,
{layers: 'Custom',transparent: "true", format: "image/png",styles:"Standard"},
{gutter:15,singleTile:true, visibility:true,opacity: 0.5,animationEnabled: false});
map.addLayer(layer1);
///////////////////////////////////////////
// add the Darkness layer
///////////////////////////////////////////
var layer2 = new OpenLayers.Layer.WMS( "Darkness",
wmsUrl,
{layers: 'Darkness',transparent: "true", format: "image/png",styles:"Standard"},
{gutter:15,singleTile:true, visibility:true,opacity: 0.5,animationEnabled: true});
map.addLayer(layer2);
///////////////////////////////////////////
// add the Fiddle layer
///////////////////////////////////////////
var layer3 = new OpenLayers.Layer.WMS( "Fiddle",
wmsUrl,
{layers: 'Fiddle',transparent: "true", format: "image/png"},
{gutter:15,singleTile:true, visibility:true,opacity: 0.5,animationEnabled: true});
map.addLayer(layer3);
////////////////////////////////////////////////////
// setup getFeatureInfo on click for all layers
////////////////////////////////////////////////////s
var click = new OpenLayers.Control.WMSGetFeatureInfo({
url: wmsUrl,
title: 'Identify features by clicking',
layers: [layer1],
queryVisible: true
})
click.events.register("getfeatureinfo", this, showInfo);
map.addControl(click);
click.activate();
}
function showInfo(event) {
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
};