scripting getfeatureinfo for multiple wms layers

المشرف العام

Administrator
طاقم الإدارة
I am not really a programmer and I'm trying to create a webservice. I copy and pasted some script examples which made my script what it is now. I have multiple wms layers, but want to show different info in the infowindow for each wms. So I thought this can be done by an if-then-else statement. First, I created the getfeatureinfo variable including the layers which need to have information shown.

var control_identify = new OpenLayers.Control.WMSGetFeatureInfo({ title : 'Klik op een lijn voor informatie', layers : [ AmiceHerkomst, AmiceVerwerking ], queryVisible : true, infoFormat : 'application/vnd.ogc.gml', vendorParams: { buffer: 5 // geoserver buffer in pixels }, eventListeners : { getfeatureinfo : function(event){ showInfo(event); } }});control_identify.events.register("getfeatureinfo", this, showInfo);then I create the showinfo function. Here I want to make an if-then-else for each wms layer I have. Something in the line of if(evt.features.length != 0) and layer = AmiceHerkomst { followed by the attributes I want from that layer. For the next layer I add at the end else if (evt.features.length != 0) and layer = AmiceVerwerking { with the attributes I want for this layer and so on. Scripting like I said above will give an error, but I think something like this should be possible?

function showInfo(evt) { var f = 0; var temstr = ""; if(evt.features.length != 0){ for (f = 0; f
 
أعلى