the WFS 1.0 standard does not support specifying the SRS name (srsName) in GetFeature requests, but GeoServer has specific support for this, this patch introduces a boolean option (add srsNameInQuery) to force the addition of srsName, initial patch from fvanderbiest, r=bartvde (closes #2228)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9838 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2009-11-23 15:56:56 +00:00
parent d9a982f169
commit 9e81d4d332
2 changed files with 24 additions and 1 deletions

View File

@@ -21,6 +21,14 @@ OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
*/
version: "1.0.0",
/**
* APIProperty: srsNameInQuery
* {Boolean} If true the reference system is passed in Query requests
* via the "srsName" attribute to the "wfs:Query" element, this
* property defaults to false as it isn't WFS 1.0.0 compliant.
*/
srsNameInQuery: false,
/**
* Property: schemaLocations
* {Object} Properties are namespace aliases, values are schema locations.
@@ -97,7 +105,8 @@ OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
featureNS: this.featureNS,
featurePrefix: this.featurePrefix,
featureType: this.featureType,
srsName: this.srsName
srsName: this.srsName,
srsNameInQuery: this.srsNameInQuery
}, options);
var node = this.createElementNSPlus("wfs:Query", {
attributes: {
@@ -105,6 +114,9 @@ OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
options.featureType
}
});
if(options.srsNameInQuery && options.srsName) {
node.setAttribute("srsName", options.srsName);
}
if(options.featureNS) {
node.setAttribute("xmlns:" + options.featurePrefix, options.featureNS);
}

View File

@@ -41,6 +41,13 @@
value: new OpenLayers.Bounds (1,2,3,4)
})
}
}, {
id: "query1",
writer: "wfs:Query",
arg: {
srsNameInQuery: true,
srsName: "EPSG:900913"
}
}, {
id: "getfeature0",
writer: "wfs:GetFeature",
@@ -94,6 +101,10 @@
</ogc:Filter>
</wfs:Query>
--></div>
<div id="query1"><!--
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="EPSG:900913" xmlns:topp="http://www.openplans.org/topp">
</wfs:Query>
--></div>
<div id="getfeature0"><!--
<wfs:GetFeature service="WFS" version="1.0.0" xmlns:topp="http://www.openplans.org/topp"
xmlns:wfs="http://www.opengis.net/wfs"