[OpenLayers-Users] getFeatureInfo doesn't work correctly

vrbikdan vrbikdan at gmail.com
Fri Mar 25 04:58:22 EDT 2011


Hi all,
I have a little problem with getFeatureInfo. I have several point layers at
GeoServer and I need see information on click on some point. I tried to
modify code in Layer Preview but if I click, it writes "No QUERY_LAYERS has
been requested, or no queriable layer in the request anyways". In Layer
Preview is everything ok, but in my map doesn't. Do you anyone some ideas,
what I should do with it?? Part of my code is below.

Thanks, Dan

body5 = new OpenLayers.Layer.WMS("nádraží a infocentra",
"http://localhost:8080/geoserver/wms",
					{width: '462',
                    layers: 'dp:body5',
                    styles: '',
                    srs: 'EPSG:900913',
                    height: '512',
                    format: 'image/png',
                    tiled: 'true',
                    tilesOrigin : map.maxExtent.left + ',' +
map.maxExtent.bottom,
					transparent: 'true'					
                    },
					{minScale: 60000, maxScale: 10000}
        );

map.events.register('click', map, function (e) {
                    document.getElementById('infoDiv').innerHTML =
"Loading... please wait...";
                    var params = {
                        REQUEST: "GetFeatureInfo",
                        EXCEPTIONS: "application/vnd.ogc.se_xml",
                        BBOX: map.getExtent().toBBOX(),
                        X: e.xy.x,
                        Y: e.xy.y,
                        INFO_FORMAT: 'text/html',
                        FEATURE_COUNT: 50,
                        Styles: '',
                        WIDTH: map.size.w,
                        HEIGHT: map.size.h,
                        format: 'text/html'};
                   
OpenLayers.loadURL("http://localhost:8080/geoserver/wms", params, this,
setHTML, setHTML);
                    OpenLayers.Event.stop(e);
                });
            
            
function setHTML(response){
            document.getElementById('infoDiv').innerHTML =
response.responseText;
            };

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/getFeatureInfo-doesn-t-work-correctly-tp6206993p6206993.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list