[OpenLayers-Commits] r12216 - in trunk/openlayers:
lib/OpenLayers/Protocol lib/OpenLayers/Protocol/WFS tests/Protocol
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Aug 8 09:23:01 EDT 2011
Author: ahocevar
Date: 2011-08-08 06:22:59 -0700 (Mon, 08 Aug 2011)
New Revision: 12216
Modified:
trunk/openlayers/lib/OpenLayers/Protocol/WFS.js
trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
trunk/openlayers/tests/Protocol/WFS.html
Log:
don't use null geometryName for WFS versions < 1.1. r=elemoine (closes #3415)
Modified: trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js 2011-08-08 12:43:47 UTC (rev 12215)
+++ trunk/openlayers/lib/OpenLayers/Protocol/WFS/v1.js 2011-08-08 13:22:59 UTC (rev 12216)
@@ -43,7 +43,7 @@
/**
* 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 @@
* 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 @@
schema: this.schema
}, this.formatOptions));
}
+ if (!options.geometryName && parseFloat(this.format.version) > 1.0) {
+ this.setGeometryName(null);
+ }
},
/**
Modified: trunk/openlayers/lib/OpenLayers/Protocol/WFS.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Protocol/WFS.js 2011-08-08 12:43:47 UTC (rev 12215)
+++ trunk/openlayers/lib/OpenLayers/Protocol/WFS.js 2011-08-08 13:22:59 UTC (rev 12216)
@@ -47,7 +47,7 @@
*
* 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
Modified: trunk/openlayers/tests/Protocol/WFS.html
===================================================================
--- trunk/openlayers/tests/Protocol/WFS.html 2011-08-08 12:43:47 UTC (rev 12215)
+++ trunk/openlayers/tests/Protocol/WFS.html 2011-08-08 13:22:59 UTC (rev 12216)
@@ -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");
More information about the Commits
mailing list