[OpenLayers-Users] Using getFeatureInfo on a vector (WFS) layer in openLayers

Joe Public joepub1962 at gmail.com
Wed Sep 1 00:09:37 EDT 2010


Hey OL....
I'm trying display the data associated with a feature (point) in a vector
(WFS) layer using the script below
When I click on the feature I get the message: 
No QUERY_LAYERS has been requested, or no queriable layer in the request
anyways 


I've used both 
"http://tobagoborn.com:8080/geoserver/WMS",
and
"http://tobagoborn.com:8080/geoserver/WFS",

as the URL in the getFeatureInfo part of the script

<script type="text/javascript">

            var map;
            function init() {
                map = new OpenLayers.Map('map', 
                {
                    maxExtent: new OpenLayers.Bounds(-10.0, -1000.0, 600.0,
1700.0)
                }
                );

                var basicflr = new OpenLayers.Layer.WMS(
                    "Floor Plan",
                    "http://tobagoborn.com:8080/geoserver/wms",
                    {layers: 'monitor:Admin'}
                );

                var wireless = new OpenLayers.Layer.WFS(
                    "Wireless",
                    "http://tobagoborn.com:8080/geoserver/wfs",
                    {
                      transparent:'true',
                      typename: 'monitor:Routers'}
                );


//                map.addControl(new OpenLayers.Control.LayerSwitcher());
                map.addLayers([basicflr, wireless]);
                map.zoomToMaxExtent();

              // support GetFeatureInfo
                map.events.register('click', map, function (e) {
                    document.getElementById('nodelist').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',
                        QUERY_LAYERS: map.layers[0].options.typename,
                        FEATURE_COUNT: 50,
                        Layers: 'monitor:Routers',
                        Styles: '',
                        Srs: 'EPSG:4326',
                        WIDTH: map.size.w,
                        HEIGHT: map.size.h,
//                        format: format
                        };
                   
OpenLayers.loadURL("http://tobagoborn.com:8080/geoserver/wms", params, this,
setHTML, setHTML);
                    OpenLayers.Event.stop(e);
                });
            
            // sets the HTML provided into the nodelist element
            function setHTML(response){
                document.getElementById('nodelist').innerHTML =
response.responseText;
            };


            }

        </script>


Any suggestion or solution would be greatly appreciated

Thanks
Joe P
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Using-getFeatureInfo-on-a-vector-WFS-layer-in-openLayers-tp5485412p5485412.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list