[OpenLayers-Users] Getting attributes from a Feature-Layer

Kai Behncke Kai-Behncke at gmx.de
Fri Mar 6 09:23:14 EST 2009


All right,

> 
> I haven`t got any clue why in that case it was not possible to get to run
> someting like:
> 
> var myFeature=myWfsLayer.getFeatureById(feature.id);
> alert (myFeature.attributes.gid);
> or e.g. alert (myFeature.data.name)....
> 

I had the wrong syntax when I implemented the wfs. The right way of course is:

var gastronomap_wfs= new OpenLayers.Layer.WFS( "small_wfs",
  "http://xyz/cgi-bin/mapserv?map=/xyz/wfs.map",
   {Typename: 'gastronomie_wfs'},{maxfeatures: 100, ,extractAttributes:true}
); 

I think in the former example the extractAttributes:false (by default) was not overwritten.

Everything fine now :-)

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01



More information about the Users mailing list