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.

sorry if I'm asking stupid questions but I really spent days trying to figure out how to add functionality to my map so that when user clicks on some map object he gets the attribute table on the side with the attribute data of that object. Is it even possible? I don't speak about popups, I speak about actual table. This is how my map looks now:

map

I would like that space on the east side of monitor populate with that attribute table when users click. I'm not saying that's the best solution but that's how I imagined that. But I'm open for suggestions.

As you can see I use geoext, openlayers and extjs and honestly, I don't know lot about php or some other frameworks so I would be happy if the solution could be solved using geoext or smilair. I was looking around but nothing what I found is what I'm actually looking for.

One more time, sorry if my question is unprofessional or something but I'm really kind of desperate :)

share|improve this question

2 Answers 2

You could use the FeatureGrid : http://api.geoext.org/1.1/examples/feature-grid.html

share|improve this answer
    
Yes, I tried with that, but every layer on my map has different attribute fields. And if I create feature grid then I first need to define attribute fields that I want to show in that grid panel. Or I got it wrong? Because if it's so, then I should create more feature grids panels, for every layer one, and that would be too much panels and informations on my map. –  user14026 Mar 16 '13 at 10:54
    
You only need to create a FeatureStore for each layer, and change the source of the DataGrid according to the layer clicked. –  Laurent Jégou Mar 16 '13 at 14:46
    
Ok, that seems like good solution. Now I just need to make it work like that. Thank you Laurent. –  user14026 Mar 16 '13 at 15:20

You can try this code, this will display a pop-up containing attribute information of layers on that particular point.

controls.push(new OpenLayers.Control.WMSGetFeatureInfo({
            autoActivate: true,
            infoFormat: "application/vnd.ogc.gml",
            maxFeatures: 10,
            eventListeners: {
                "getfeatureinfo": function(e) {
                    var items = [];
                    Ext.each(e.features, function(feature) {
                        items.push({
                            xtype: "propertygrid",
                            title: feature.fid,
                            source: feature.attributes,
                            editable: false
                        });
                    });
                    new GeoExt.Popup({
                        title: "Feature Info",
                        width: 300,
                        height: 500,
                        layout: "accordion",
                        map: app.mapPanel,
                        location: e.xy,
                        items: items
                    }).show();
                }
            }
        }));

Ref: http://workshops.boundlessgeo.com/geoext/stores/getfeatureinfo.html

share|improve this answer

Your Answer

 
discard

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