Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
Yes,It works.Thanks lot for you –  sacprasanna Jun 28 '12 at 17:05
    
And I don't want to all attribute fields of shape file.How I remove some fields from map? –  sacprasanna Jun 28 '12 at 18:36
    

take a look at this post here

Try replace removeLayersOutOfRange() by your raster.

Caroline

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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