auto-create the GetFeature readFormat for known outputFormats. r=tschaub (closes #2968)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10955 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -42,7 +42,27 @@ OpenLayers.Protocol.WFS.v1_1_0 = OpenLayers.Class(OpenLayers.Protocol.WFS.v1, {
|
||||
* featurePrefix - {String} Feature namespace alias (optional - only used
|
||||
* if featureNS is provided). Default is 'feature'.
|
||||
* geometryName - {String} Name of geometry attribute. Default is 'the_geom'.
|
||||
* outputFormat - {String} Optional output format to use for WFS GetFeature
|
||||
* requests. This can be any format advertized by the WFS's
|
||||
* GetCapabilities response. If set, an appropriate readFormat also
|
||||
* has to be provided, unless outputFormat is GML3, GML2 or JSON.
|
||||
* readFormat - {<OpenLayers.Format>} An appropriate format parser if
|
||||
* outputFormat is none of GML3, GML2 or JSON.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
OpenLayers.Protocol.WFS.v1.prototype.initialize.apply(this, arguments);
|
||||
if (this.outputFormat && !this.readFormat) {
|
||||
if (this.outputFormat.toLowerCase() == "gml2") {
|
||||
this.readFormat = new OpenLayers.Format.GML.v2({
|
||||
featureType: this.featureType,
|
||||
featureNS: this.featureNS,
|
||||
geometryName: this.geometryName
|
||||
});
|
||||
} else if (this.outputFormat.toLowerCase() == "json") {
|
||||
this.readFormat = new OpenLayers.Format.GeoJSON();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Protocol.WFS.v1_1_0"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user