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 have done point layer overlay with openlayer. Whenever i click any point, its showing me all the data of the table(postgresql) in popup. How to control amount of data in the popup?

All the columns are being displayed in popup. I just want location_name to be displayed in the popup. how to extract location_name from event.text?

Code is:

....
info = new OpenLayers.Control.WMSGetFeatureInfo({
    url: 'http://localhost:8080/geoserver/layername/wms',  // geoserver point layer 
    title: 'Identify features by clicking',
    queryVisible: true,
    eventListeners: {
        getfeatureinfo: function(event) {
            map.addPopup(new OpenLayers.Popup.FramedCloud(
                "ABCD", 
                map.getLonLatFromPixel(event.xy),
                null,
                event.text,
                null,
                true
            ));
        }
    }
});
map.addControl(info);
info.activate();
share|improve this question
add comment

1 Answer

Instead of event.text just send whatever HTML you want to have displayed.

You can do this by calling a fuction with event.text as argument, and then parsing output and returning whatever you want.

Try looking at event.features and extracting info from there, and then constructing HTML string with that info. I thing then you should pass just event. Try looking at that object in Firebug or Chrome dev. tools.

share|improve this answer
    
That's too cumbersome process!! Any other way out? –  xtras Apr 9 '13 at 13:49
add comment

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.