Database Reference
In-Depth Information
9. AftercreatingtheGoogleandWMSlayers,youneedtoaddallofthemtothe
map, using the following code:
// add all of the layers to the map
map.addLayers([mapserver_wms,
geoserver_wms, google_ter, google_hyb]);
10. You want to provide the user with the possibility to identify features of the
countiesWMS.Addthe WMSGetFeatureInfo OpenLayerscontrol(thatwill
send GetFeatureInfo requeststotheWMSbehindthescenes)thatpoint
tothecountiesPostGISlayerservedbytheGeoServerWMS,usingthefol-
lowing code:
var info = new
OpenLayers.Control.WMSGetFeatureInfo({
url: geoserver_url,
title: 'Identify',
queryVisible: true,
eventListeners: {
getfeatureinfo: function(event) {
map.addPopup(new
OpenLayers.Popup.FramedCloud(
"WMSIdentify",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
}
}
});
map.addControl(info);
info.activate();
11. Finally,setthecenterofthemapanditsinitialzoomlevel,usingthefollowing
code:
Search WWH ::




Custom Search