[OpenLayers-Users] which feature is from wich layer in WMSGFI

Olivier Terral olivier at geomatic.ch
Wed Jun 20 02:10:17 PDT 2012


Hi Dan,

When you receive the result of a GetFeatureInfo, the features are not added to a layer yet so the property layer should be null.

You should have a look on others properties of your feature like event.features[i].attributes or event.features[i].type.

If the name of the layer isn't in these properties try look directly in the code how the class OpenLayers.Format.WMSGetFeatureInfo parse the result of the request 


Regards


Le 19 juin 2012 à 12:24, vrbikdan a écrit :

> Hi all,
> I'm using WMSGetFeatureInfo for writting information about feature. But now
> I need to know, which feature in response is from which layer. Problem is,
> that I'm using infoFormat: 'application/vnd.ogc.gml'. My code is here:
> 
> infoPropVar = new OpenLayers.Control.WMSGetFeatureInfo(
> 	{
>            url: "http://192.168.1.92:8080/geoserver/zk/wms", 
>            title: '',
>            queryVisible: true,
> 			infoFormat: 'application/vnd.ogc.gml',
> 			eventListeners: 
> 			{				
>                getfeatureinfo: function(event) 
> 				{
> 					for (i=0; i<event.features.length; i++)
> 					{
>                                            alert();
> 					}
> 				}
> 			}
> 	});
> 	map.addControl(infoPropVar);
> 	infoPropVar.activate();
> 
> I tried write event.features[i].layer/name/layerName and so on but nothing.
> Do you have any tip how I can extract which feature in response is from
> which layer?
> 
> Thanks a lot
> Dan
> 
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/which-feature-is-from-wich-layer-in-WMSGFI-tp4982353.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

Olivier Terral


 
GEOMATIC Ingénierie SA
Société du groupe Ringier
Chemin des Croisettes 26
1066 Epalinges
www.geomatic.ch
www.thevirtualcity.ch
Tél:: +41 (21) 651 30 00
Fax: +41 (21) 651 30 09




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120620/1440fa16/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.gif
Type: image/gif
Size: 5116 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120620/1440fa16/attachment-0001.gif>


More information about the Users mailing list