[OpenLayers-Users] GetFeatureInfo

Nina Helle-Mildt helle at sdac.hannover.bgr.de
Tue Nov 4 09:31:45 EST 2008


Hi to all,

thanks a lot to all of you who gave me some ideas. I tried the way Arnd 
Wippermann suggested and it seems as if one of my WMS isn't correct. So 
I have to go back to UMN MapServer ...

Regards
Nina




Arnd Wippermann wrote:
> I would try something like this:
> 
> var url =  seis.getFullRequestString( ....
> var url2 = seis_ger.getFullRequestString( ....
> 
> 	OpenLayers.loadURL(url, '', this, setHTML);
>        	OpenLayers.Event.stop(e);
>        	});
>        	function setHTML(response) {
>        	OpenLayers.Util.getElement('nodeList').innerHTML +=
>          response.responseText;}
> 
> 	OpenLayers.loadURL(url2, '', this, setHTML);
>        	OpenLayers.Event.stop(e);
>        	});
>        	function setHTML(response) {
>        	OpenLayers.Util.getElement('nodeList').innerHTML +=
>          response.responseText;}
> 
> You have to request both layers. Perhaps it works.
> 
> Arnd Wippermann
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
> Auftrag von Nina Helle-Mildt
> Gesendet: Freitag, 31. Oktober 2008 12:00
> An: OpenLayers
> Betreff: [OpenLayers-Users] GetFeatureInfo
> 
> Hi there,
> 
> a couple of weeks ago I already posted a mail on querying layers using the
> GetFeatureUnfo request. Many thanks to all of you who tried to help me!
> Nevertheless I'm still struggeling with this task:
> 
> I have two overlay layers (both wms layers) displaying point data. What I
> want to do is, clicking a point object of one of the two layers with the
> mouse in order to get the results of this query displayed in an defined area
> next to the map.
> 
> I would appreciate any help - a complete example would be great!
> 
> Best regards
> Nina
> 
> 
> Below parts of my code:
> 
> //Overlay Layers:
> var seis = new OpenLayers.Layer.WMS.Untiled("Erdbeben weltweit ", 	 
> "http://www.seismologie.bgr.de:8080/cgi-bin/mapserv?map=seis_wms.map",
> 		{transparent: 'true', layers:
>                  ['q_year','q_month','q_week','aktuell_welt']},
> 		{'buffer': 1},
> 		{singleTile: true, 'ratio': 1.0},
> 		{'isBaseLayer': false, 'gutter': 20});
> 				
> var seis_ger = new OpenLayers.Layer.WMS.Untiled("Erdbeben 
> Deutschland",	 
> "http://www.seismologie.bgr.de:8080/cgi-bin/mapserv?map=seis_d_wms.map",
> 		{transparent: 'true', layers:
>                  ['q_year_ger','q_month_ger','q_week_ger',
>                  'aktuell_ger','box']},
> 		{'buffer': 1},
> 		{singleTile: true, 'ratio': 1.0},
> 		{'isBaseLayer': false, 'gutter': 20});
> 				
> ...
> 
> //Support GetFeatureInfo
> 	
> map.events.register('click', map, function (e) {
> document.getElementById('nodeList').innerHTML = "Einen Moment bitte ...";
>      	var url =  map.layers[0].getFullRequestString(
> 	   {
>        		REQUEST: "GetFeatureInfo",
>        		EXCEPTIONS: "application/vnd.ogc.se_xml",
>        		BBOX: map.getExtent().toBBOX(),
>        		X: e.xy.x,
>        		Y: e.xy.y,
>        		INFO_FORMAT: 'text/html',
>        		QUERY_LAYERS: map.layers[0].params.LAYERS,
> 		FEATURE_COUNT: 50,
>        		WIDTH: map.size.w,
>        		HEIGHT: map.size.h}
> 	    );
>        		
> 	OpenLayers.loadURL(url, '', this, setHTML);
>        	OpenLayers.Event.stop(e);
>        	});
>        	function setHTML(response) {
>        	OpenLayers.Util.getElement('nodeList').innerHTML =
>          response.responseText;}
> 
> 
> 
> 
> //Support GetFeatureInfo - this Version (works great with only 1 layer)
> 
> //	map.events.register('click', map, function (e) {
> //	//document.getElementById('map').style.cursor = 'crosshair';
> //	OpenLayers.Util.getElement('nodeList').innerHTML = "Einen Moment 
> bitte ...";
> //	var url =  seis.getFullRequestString({
> //		REQUEST: "GetFeatureInfo",
> //		EXCEPTIONS: "application/vnd.ogc.se_xml",
> //		BBOX: seis.map.getExtent().toBBOX(),
> //		X: e.xy.x,
> // 		Y: e.xy.y,
> // 		INFO_FORMAT: 'text/html',
> //		QUERY_LAYERS: seis.params.LAYERS,
> //		WIDTH: seis.map.size.w,
> //		HEIGHT: seis.map.size.h});
> //		OpenLayers.loadURL(url, '', this, setHTML);
> //alternativ: 
> window.open(url);
> //		OpenLayers.Event.stop(e);
> //		});
> // 		function setHTML(response) {
> //		OpenLayers.Util.getElement('nodeList').innerHTML = 
> response.responseText;}
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 



More information about the Users mailing list