OpenLayers OpenLayers

Changeset 6422

Show
Ignore:
Timestamp:
02/29/08 13:39:37 (6 months ago)
Author:
crschmidt
Message:

Improve WFS reprojection:

  • Transform bbox back to layer projection
  • Transform commits back to layer projection

r=tschaub, (Closes #1406)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Layer/WFS.js

    r6314 r6422  
    278278            var params = {BBOX: this.encodeBBOX ? tileBounds.toBBOX()  
    279279                                                : tileBounds.toArray()}; 
     280             
     281            if (this.map && !this.projection.equals(this.map.getProjectionObject())) { 
     282                var projectedBounds = tileBounds.clone(); 
     283                projectedBounds.transform(this.map.getProjectionObject(),  
     284                                          this.projection); 
     285                params.BBOX = this.encodeBBOX ? projectedBounds.toBBOX()  
     286                                              : projectedBounds.toArray(); 
     287            }                                   
     288 
    280289            url += "&" + OpenLayers.Util.getParameterString(params); 
    281290 
     
    435444    commit: function() { 
    436445        if (!this.writer) { 
    437             this.writer = new OpenLayers.Format.WFS({},this); 
     446            var options = {}; 
     447            if (this.map && !this.projection.equals(this.map.getProjectionObject())) { 
     448                options.externalProjection = this.projection; 
     449                options.internalProjection = this.map.getProjectionObject(); 
     450            }     
     451             
     452            this.writer = new OpenLayers.Format.WFS(options,this); 
    438453        } 
    439454