OpenLayers OpenLayers

Changeset 7413

Show
Ignore:
Timestamp:
06/21/08 09:09:23 (2 months ago)
Author:
crschmidt
Message:

WKT Format reprojects geometrycollection components twice. Fixed by anonymous
contributor. (Closes #1554)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Format/WKT.js

    r5614 r7413  
    6868                    features.geometry.transform(this.externalProjection, 
    6969                                                this.internalProjection); 
    70                 } else if (features && typeof features == "object") { 
     70                } else if (features && 
     71                           type != "geometrycollection" && 
     72                           typeof features == "object") { 
    7173                    for (var i = 0; i < features.length; i++) { 
    7274                        var component = features[i]; 
  • trunk/openlayers/tests/Format/WKT.html

    r6719 r7413  
    217217    } 
    218218 
     219    function test_Format_WKT_read_projection(t) { 
     220        t.plan(1); 
     221 
     222        var projections = { 
     223            src:  new OpenLayers.Projection("EPSG:4326"), 
     224            dest: new OpenLayers.Projection("EPSG:900913") 
     225        }; 
     226 
     227        var points = { 
     228            src:  new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-87.9, 41.9)), 
     229            dest: new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(-9784983.239366667, 5146011.678566458)) 
     230        }; 
     231 
     232        var format = new OpenLayers.Format.WKT({ 
     233            externalProjection: projections["src"], 
     234            internalProjection: projections["dest"], 
     235        }); 
     236        var feature = format.read("GEOMETRYCOLLECTION(POINT(" + points["src"].geometry.x + " " + points["src"].geometry.y + "))")[0]; 
     237        t.eq(feature.geometry.toString(), points["dest"].geometry.toString(),  
     238            "Geometry collections aren't transformed twice when reprojection."); 
     239    } 
    219240    </script>  
    220241</head>