Improve WFS reprojection:

* Transform bbox back to layer projection
 * Transform commits back to layer projection
r=tschaub, (Closes #1406)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@6422 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-02-29 18:39:37 +00:00
parent 05858dc9fb
commit e54074e6f1
2 changed files with 185 additions and 1 deletions

View File

@@ -277,6 +277,15 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
var params = {BBOX: this.encodeBBOX ? tileBounds.toBBOX()
: tileBounds.toArray()};
if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
var projectedBounds = tileBounds.clone();
projectedBounds.transform(this.map.getProjectionObject(),
this.projection);
params.BBOX = this.encodeBBOX ? projectedBounds.toBBOX()
: projectedBounds.toArray();
}
url += "&" + OpenLayers.Util.getParameterString(params);
if (!this.tile) {
@@ -434,7 +443,13 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
*/
commit: function() {
if (!this.writer) {
this.writer = new OpenLayers.Format.WFS({},this);
var options = {};
if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
options.externalProjection = this.projection;
options.internalProjection = this.map.getProjectionObject();
}
this.writer = new OpenLayers.Format.WFS(options,this);
}
var data = this.writer.write(this.features);