[OpenLayers-Users] hardcoded gml:featureMemeber of WFS layer in openlayers ?

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Tue Jul 6 08:50:05 EDT 2010


Hi,

basically this requires writing your own format, which can extend
OpenLayers.Format.GML.v3.

OpenLayers only supports the GML 3.1.1 Simple Features profile out of the
box:

http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd

It should not be too hard to write the format. Make sure you add wfsos to
the namespaces array and add a reader function where necessary.

Btw, in your code below you are using the old GML parser.

Best regards,
Bart

> hi everyone,
>
> I have a problem adding a WFS request as overlay on the openlayers map.
> Is there a way to tell it to search for other featureProperty elements
> then the basic "gml:featureMember" ?
> Is it realy hard-coded into the parser source that the featureProperty
> name shall be "gml:featureMember" ?
>
> The WFS service is set up with a GML Application Profile which defines
> its "FeaturePropertyType" as a restriction of the generic
> gml:FeaturePropertyType (and similar for the FeatureCollectionType).
> This means that the structure of the GML returned from the WFS request is:
>
> <wfsos:featureCollection
> xmlns:wfsos="http://cweb.ksat.no/cweb/schema/geoweb/oil" ...
> schemaLocation="http://cweb.ksat.no/cweb/schema/geoweb/oil ...>
>     <wfsos:featureMember>
>         <wfsos:feature>
>             <wfsos:oilSpill>
>                 <gml:Polygon srsName="EPSG:4326"> ........
>
> It seems that the featureCollection level is ignored (as well as the
> schema location - since the schema is not loaded), so that one is not
> the problem.
> I can set the name space prefix, and element name for the "feature"
> level and the geometry, but can't find any way to do this for the
> featureMember level!
>
> If I run this from a file, and change the wfsos:featureMember into
> gml:featureMember it works fine (even if it violates the schema).
>
> To repeat the question: Is there any way to instruct openlayers to look
> for wfsos:featureMember instead ?
>
> PS:
> Here is the code for the WFS request linkage:
>
>              wfs_ksat = new OpenLayers.Layer.Vector(id, {
>                      strategies: [new OpenLayers.Strategy.BBOX()],
>                      projection: new OpenLayers.Projection("EPSG:4326"),
>                      protocol: new OpenLayers.Protocol.WFS.v1_0_0({
>                          url: ksatWFSuri,
>                          featureType: "feature",
>                          featureNS:
> "http://cweb.ksat.no/cweb/schema/geoweb/oil",
>                          featurePrefix: "wfsos",
>                          geometryName: "oilSpill",
>                          srsName: "EPSG:4326",
>                          readFormat: new OpenLayers.Format.GML(),
>                          outputFormat: "GML2"
>                      }),
>                      styleMap: styleMap
>                  });
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>





More information about the Users mailing list