[OpenLayers-Users] Problem with WMSgetfeatureinfo control

Paul Wittle pwittle at peterbrett.com
Thu Aug 16 03:19:50 PDT 2012


Hi folks,

After a morning of list surfing and tweaks this one has me beat...I'm having trouble getting a WMSgetfeatureinfo control to work.  The original overlays were in WGS84 whilst the mapping is OSGB but I've not reprojected the layer in GeoServer so I don't think it should be a projection issue.

I've added layers:[] and layerurls:[] to the infocontrol and then subsequently moved the layer control to the for loop at the bottom (see code example below).

    var infoControls = {
         click: new OpenLayers.Control.WMSGetFeatureInfo({
         url: "https://domain/geoserver/wms",
         layerurls: ["https://domain/geoserver/database/wms","https://domain/geoserver/ODS/wms"],
         title: 'Identify features by clicking',
         queryVisible: true
        })
    };

    //Add the appropriate handlers
    for (var i in infoControls) {
            infoControls[i].events.register("getfeatureinfo", this, showInfo);
            map.addControl(infoControls[i]);
    }
    infoControls.click.activate();

    for (var key in infoControls) {
           var control = infoControls[key];
           control.layers = [DCycle, PCycle];
    }

The domain is not available publicly so it is difficult of you to test the issue but perhaps I'm missing something obvious.  The layer definition is as follows:

var DCycle = new OpenLayers.Layer.WMS("Raw Locations",
            "https://domain/geoserver/database/wms", {
             LAYERS: 'database:cycleracksOSGB',
             srs: 'EPSG:27700',
             STYLES: '',
             format: format,
            transparent: 'true',
            tiled: true,
            tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom
}, {
           buffer: 0,
          displayOutsideMaxExtent: true,
          isBaseLayer: false,
          // exclude this layer from layer container nodes
          displayInLayerSwitcher: true
});

var PCycle = new OpenLayers.Layer.WMS("Published Locations",
          "https://domain/geoserver/ODS/wms", {
            LAYERS: 'ODS:ODScycleOSGB',
           STYLES: '',
           format: format,
           transparent: 'true',
           tiled: true,
           tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom
}, {
           buffer: 0,
           displayOutsideMaxExtent: true,
           isBaseLayer: false,
          // exclude this layer from layer container nodes
          displayInLayerSwitcher: true
});

var mapPanel = new GeoExt.MapPanel({
         renderTo:'mapContainer',
         width: 600,
         height: 400,
         map: map,
         zoom: 6.5,
         title: 'Map Window',
         layers: [BMap, DCycle, PCycle]
});

The problem is that clicking on the map has no effect the get feature request is ignored. This only happens when I try to limit the layers, but that said, I think it only queries the base map so it must be a problem with the layer definition but I'm not sure what. Any suggestions?

Thanks,
Paul

Peter Brett Associates LLP is a limited liability partnership registered in England and Wales. Registered number: OC334398. Roger Tym & Partners and Baker Associates are part of Peter Brett Associates LLP. A list of members is open to inspection at our registered office. Registered Office: Caversham Bridge House, Waterman Place, Reading, Berkshire, RG1 8DN. UK T: +44 (0)118 950 0761 F: +44 (0)118 959 7498. Brett Consulting Limited is wholly owned by Peter Brett Associates LLP. Registered number: 07765026. Registered address: as above.

Email is used as a convenient medium for rapid data transfer. Any contractual correspondence sent or received by email will not be held to be such unless and until it is received in writing by fax or letter. Likewise, file attachments must be treated as uncontrolled documents until issued as hard copy. This email and any files transmitted with it are confidential and may be legally privileged, and are intended solely for the use of the individual or entity to which they are addressed. If an addressing or transmission error has misdirected this email please notify the author by replying to this email and delete the email. If you are not the intended recipient you must not use or disclose, print or rely on this email. You are advised that you open any attachment at your own risk.

Any OS Data attached to this email is issued in accordance with Licence No. 100021575 under condition that it is used to plot once and not retained on the recipients computer system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120816/47fbfbe5/attachment.html>


More information about the Users mailing list