[OpenLayers-Users] Adding features from WFS to Vector layer question

David Alda Fernandez de Lezea dalda at ikt.es
Thu Apr 15 06:13:41 EDT 2010


Hi, 

I'm trying to add some features from 2 WFS different layers to the same Vector Layer in Openlayers. If I don't ask for any attribute apart from the geometry, the features are added without any problem. But in my case I want the features to be added with some attributes that may differ. For example, I ask the following:

<wfs:GetFeature>
<wfs:Query typeName="RecintosSigpac">
<PropertyName>msGeometry</PropertyName>
<PropertyName>PROVINCIA</PropertyName>
<PropertyName>MUNICIPIO</PropertyName>
<PropertyName>POLIGONO</PropertyName>
<PropertyName>PARCELA</PropertyName>
<PropertyName>RECINTO</PropertyName><ogc:Filter>... FILTER HERE ...</ogc:Filter>
</wfs:Query>
<wfs:Query typeName="ParcelasSigpac">
<PropertyName>msGeometry</PropertyName>
<PropertyName>PROVINCIA</PropertyName>
<PropertyName>MUNICIPIO</PropertyName>
<PropertyName>POLIGONO</PropertyName>
<PropertyName>PARCELA</PropertyName>><ogc:Filter>... FILTER HERE ...</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

They differ in one attribute, but I want them to be in the same layer. I add the fetures using GML:

var fetures = new OpenLayers.Format.GML.v3({featureType: layerName,featureNS: "http://mapserver.gis.umn.edu/mapserver" }).read(data);
vectorLayer.addFeatures(fetures);

I loop through a layerName array to add the features, but I get an error:

obj.attributes is undefined
[Break on this error] obj.features.push(feature);},"_geometr...Members";}else{name="featureMember";} 

It is caused because I'm processing features with different attributes?? How can I solve it??

Thanks.
 
 
Un saludo,
 
··················································································

David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
 
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)

··················································································
Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
··················································································
email: dalda at ikt.es                                web: www.ikt.es
··················································································



More information about the Users mailing list