[OpenLayers-Users] features.length is 0 (beginner question)

Andreas Hocevar ahocevar at opengeo.org
Fri Nov 4 03:03:41 EDT 2011


If you want features, you need a WMS that supports GML as output format for
GetFeatureInfo. For WMS 1.1.1, the format is "application/vnd.ogc.gml". It
has to be provided as the infoFormat options.

Andreas.
On Sep 18, 2011 11:40 AM, "juhulian" <hansfux1 at web.de> wrote:

> Hi there,
> I'm using the standard example for a getfeatureinfo popup and now I want to
> use some of the attribute data of the feature that was clicked, but the
> event.features array is just empty when I try the alert...
>
>  info = new OpenLayers.Control.WMSGetFeatureInfo({
>            url: 'http://localhost:8080/geoserver/wms/',
>            title: 'Identify features by clicking',
>            queryVisible: true,
>            eventListeners: {
>            getfeatureinfo: function(event) {
>                    alert(event.features.length);
>                    map.addPopup(new OpenLayers.Popup.FramedCloud(
>                        "chicken", //id
>                        map.getLonLatFromPixel(event.xy), //koord auf dem
> event
>                        null, //contentsize
>                        event.text, //contentHtml
>                        null, //anchor
>                        true //closeBox
>                    ),true);
>                }
>            }
>        });
>
> any help is appreciated,
> julian
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/features-length-is-0-beginner-question-tp6805453p6805453.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111104/0aaf6896/attachment-0001.html


More information about the Users mailing list