[OpenLayers-Users] extract attributes from a geoserver wms [SEC=Unclassified]

Miles Jordan Miles.Jordan at aad.gov.au
Wed Jul 28 21:07:07 EDT 2010


The content of a GetFeatureInfo response is determined by the WMS - you have very little control over what it outputs from the client side apart from applying CSS to it.

Assuming you are using Geoserver, you can create a template for what the getFeatureInfo response should look like either on a global or per-feature type level.

http://docs.geoserver.org/stable/en/user/tutorials/GetFeatureInfo/index.html
http://docs.geoserver.org/stable/en/user/tutorials/freemarker.html

Regards,

Miles


Giuseppe Naponiello wrote:
> Hi all,
> my problem is:
> I have a map with two wms layers served by GeoServer, and would like
> to display in a pop-up some attributes of the second layer.
> I would also like to customize the pop-ups.
> I tried several ways but the one I work is:
> #info = new OpenLayers.Control.
> #WMSGetFeatureInfo ((
> #            url: 'http://10.0.0.161:8080/geoserver/wms',
> #           title: 'Identify features by clicking',
> #            queryVisible: true,
> #            eventListeners: (
> #                getfeatureinfo: function (event) (
> #                    map.addPopup (new OpenLayers.Popup.FramedCloud (
> #                        "Chicken"
> #                        map.getLonLatFromPixel (event.xy)
> #                        null
> #                        event.text,
> #                        null
> #                        true
> #                    ));
> #                )
> #            )
> #        ));
> #        map.addControl (info);
> #        info.activate ();
>
> With this code, however, I see the pop-up with "all" attributes in a
> table. There is an alternative way, which doesn't uses GML, KML and
> other formats, but uses only wms or wfs?
>
> Another problem:
> I tried with wfs but even I can not see nothing on the map!
> I've tried with this code:
>
> #var wfslayer = new OpenLayers.Layer.Vector("WFS", { #   strategies:
> [new OpenLayers.Strategy.BBOX()], #   protocol: new
> OpenLayers.Protocol.WFS({ #             url:
> "http://10.0.0.161:8080/geoserver/wfs", #             featureType:
> "aeroporti", #             featureNS: "http://geoserver.org
> <http://geoserver.org/> ", #             srsName: "EPSG:4326", #
>     version: "1.0.0" #             }) #});
>
>
> thanks to all
>
>




___________________________________________________________________________

    Australian Antarctic Division - Commonwealth of Australia
IMPORTANT: This transmission is intended for the addressee only. If you are not the
intended recipient, you are notified that use or dissemination of this communication is
strictly prohibited by Commonwealth law. If you have received this transmission in error,
please notify the sender immediately by e-mail or by telephoning +61 3 6232 3209 and
DELETE the message.
        Visit our web site at http://www.antarctica.gov.au/
___________________________________________________________________________


More information about the Users mailing list