[OpenLayers-Users] GetFeatureInfo

Eric Lemoine eric.c2c at gmail.com
Fri Oct 31 13:25:11 EDT 2008


SelectFeature won't help with WMS layers. Eric

2008/10/31, Indika Tantrigoda <indika85 at gmail.com>:
> Hi,
> I too had the same problem, but it was with a wfs point layer.
> I was able to get around this by using selectFeature (thanks to all on the
> list who helped me out)
>
> Check this out
> http://www.nabble.com/WFS-Layers%2C-Markers%2C-Popups-to20189787.html
>
> Maybe this could give you a clue.
>
> Regards,
> Indika
>
> 2008/10/31 Nina Helle-Mildt <helle at sdac.hannover.bgr.de>
>
>> 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