1

I use this example code get feature info from my openlayers web map.I add 4 layers to map including raster image as base map. But i don't need feature info from that raster layer.But when clicking on the map to get information It gives information of all layers.

How I modify above mentioned example code to prevent information from raster layer?

Pls help me,Any idea welcome.Thanks

3

In that example you'll see some code like:

        infoControls = {
        click: new OpenLayers.Control.WMSGetFeatureInfo({
            url: 'http://demo.opengeo.org/geoserver/wms', 
            title: 'Identify features by clicking',
            layers: [water],
            queryVisible: true
        }),
        hover: new OpenLayers.Control.WMSGetFeatureInfo({
            url: 'http://demo.opengeo.org/geoserver/wms', 
            title: 'Identify features by clicking',
            layers: [water],
            hover: true,
            // defining a custom format options here
            formatOptions: {
                typeName: 'water_bodies', 
                featureNS: 'http://www.openplans.org/topp'
            },
            queryVisible: true
        })
    };

This sets up the getFeatureInfo request on the water layer - you need to modify your code to have just the layer names that you want to query in those spaces. That is don't include your raster layer in that array if you want to exclude it from the request.

1

take a look at this post here

Try replace removeLayersOutOfRange() by your raster.

Caroline

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.