don't use null geometryName for WFS versions < 1.1. r=elemoine (closes #3415)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12216 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -47,7 +47,7 @@ OpenLayers.Protocol.WFS = function(options) {
|
||||
*
|
||||
* This function is designed to auto-configure <url>, <featureType>,
|
||||
* <featurePrefix> and <srsName> for WFS <version> 1.1.0. Note that
|
||||
* srsName matching with the WMS layer will not work with WFS 1.0.0..
|
||||
* srsName matching with the WMS layer will not work with WFS 1.0.0.
|
||||
*
|
||||
* Parameters:
|
||||
* layer - {<OpenLayers.Layer.WMS>} WMS layer that has a matching WFS
|
||||
|
||||
@@ -43,7 +43,7 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
/**
|
||||
* Property: geometryName
|
||||
* {String} Name of the geometry attribute for features. Default is
|
||||
* "the_geom".
|
||||
* "the_geom" for WFS <version> 1.0, and null for higher versions.
|
||||
*/
|
||||
geometryName: "the_geom",
|
||||
|
||||
@@ -102,19 +102,16 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
* for this featureType).
|
||||
* featurePrefix - {String} Feature namespace alias (optional - only used
|
||||
* for writing if featureNS is provided). Default is 'feature'.
|
||||
* geometryName - {String} Name of geometry attribute. If featureNS is not
|
||||
* configured, the default is null to avoid failing on BBOX filters,
|
||||
* and it will be set on <read>. Otherwise, the default is 'the_geom'.
|
||||
* geometryName - {String} Name of geometry attribute. The default is
|
||||
* 'the_geom' for WFS <version> 1.0, and null for higher versions. If
|
||||
* null, it will be set to the name of the first geometry found in the
|
||||
* first read operation.
|
||||
* multi - {Boolean} If set to true, geometries will be casted to Multi
|
||||
* geometries before they are written in a transaction. No casting will
|
||||
* be done when reading features.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Protocol.prototype.initialize.apply(this, [options]);
|
||||
if (!options.geometryName && !options.featureNS) {
|
||||
// poorly configured protocol - try to not fail on BBOX filters
|
||||
this.geometryName = null;
|
||||
}
|
||||
if(!options.format) {
|
||||
this.format = OpenLayers.Format.WFST(OpenLayers.Util.extend({
|
||||
version: this.version,
|
||||
@@ -126,6 +123,9 @@ OpenLayers.Protocol.WFS.v1 = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
schema: this.schema
|
||||
}, this.formatOptions));
|
||||
}
|
||||
if (!options.geometryName && parseFloat(this.format.version) > 1.0) {
|
||||
this.setGeometryName(null);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -111,7 +111,8 @@
|
||||
var protocol = new OpenLayers.Protocol.WFS({
|
||||
url: "http://some.url.org",
|
||||
featurePrefix: "topp",
|
||||
featureType: "tasmania_roads"
|
||||
featureType: "tasmania_roads",
|
||||
geometryName: null
|
||||
});
|
||||
|
||||
protocol.parseResponse({responseText: document.getElementById("query_response").firstChild.nodeValue});
|
||||
@@ -299,7 +300,7 @@
|
||||
}
|
||||
|
||||
function test_fromWMSLayer(t) {
|
||||
t.plan(8);
|
||||
t.plan(9);
|
||||
var map = new OpenLayers.Map("map", {
|
||||
projection: "EPSG:1234"
|
||||
});
|
||||
@@ -313,6 +314,7 @@
|
||||
t.eq(protocol.featureType, "states", "typeName correctly extracted");
|
||||
t.eq(protocol.srsName, "EPSG:1234", "srsName set correctly");
|
||||
t.eq(protocol.version, "1.1.0", "version set correctly");
|
||||
t.eq(protocol.format.geometryName, null, "format's geometryName set to null");
|
||||
|
||||
layer.params["LAYERS"] = ["topp:street_centerline", "topp:states"];
|
||||
layer.projection = new OpenLayers.Projection("EPSG:900913");
|
||||
|
||||
Reference in New Issue
Block a user