OpenLayers OpenLayers

Changeset 3158

Show
Ignore:
Timestamp:
05/21/07 10:24:55 (2 years ago)
Author:
tschaub
Message:

#708 - make the WKT format like the other vector formats - serialize/deserialize features instead of geometries

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/examples/wkt.html

    r3043 r3158  
    7979         
    8080        function displayWKT(feature) { 
    81             var str = wkt.write(feature.geometry); 
     81            var str = wkt.write(feature); 
    8282            // not a good idea in general, just for this demo 
    8383            str = str.replace(/,/g, ', '); 
     
    8787        function parseWKT() { 
    8888            var element = document.getElementById('wkt'); 
    89             var collection = wkt.read(element.value); 
     89            var features = wkt.read(element.value); 
    9090            var bounds; 
    91             if(collection) { 
    92                 if(collection.constructor != Array) { 
    93                     collection = [collection]; 
     91            if(features) { 
     92                if(features.constructor != Array) { 
     93                    features = [features]; 
    9494                } 
    95                 var features = []; 
    96                 for(var i=0; i<collection.length; ++i) { 
    97                     features.push(new OpenLayers.Feature.Vector(collection[i])); 
     95                for(var i=0; i<features.length; ++i) { 
    9896                    if (!bounds) { 
    99                         bounds = collection[i].getBounds(); 
     97                        bounds = features[i].geometry.getBounds(); 
     98                    } else { 
     99                        bounds.extend(features[i].geometry.getBounds()); 
    100100                    } 
    101                     bounds.extend(collection[i].getBounds()); 
    102101                     
    103102                } 
  • trunk/openlayers/lib/OpenLayers/Format/WKT.js

    r2978 r3158  
    2626 
    2727    /** 
    28      * Deserialize a WKT string and return an OpenLayers.Geometry or an array 
    29      * of OpenLayers.Geometry.  Supports WKT for POINT, MULTIPOINT, LINESTRING, 
    30      * MULTILINESTRING, POLYGON, MULTIPOLYGON, and GEOMETRYCOLLECTION. 
     28     * Deserialize a WKT string and return an OpenLayers.Feature.Vector or an 
     29     * array of OpenLayers.Feature.Vector.  Supports WKT for POINT, MULTIPOINT, 
     30     * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and 
     31     * GEOMETRYCOLLECTION. 
    3132     * @param {String} wkt A WKT string 
    32      * @returns {OpenLayers.Geometry|Array} A geometry or array of geometries 
    33      *                                      for GEOMETRYCOLLECTION WKT. 
     33     * @returns {OpenLayers.Feature.Vector|Array} A feature or array of 
     34     *                                            features for 
     35     *                                            GEOMETRYCOLLECTION WKT. 
    3436     */ 
    3537    read: function(wkt) { 
    36         var geometry, type, str; 
     38        var features, type, str; 
    3739        var matches = this.regExes.typeStr.exec(wkt); 
    3840        if(matches) { 
     
    4042            str = matches[2]; 
    4143            if(this.parse[type]) { 
    42                 geometry = this.parse[type].apply(this, [str]); 
    43             } 
    44         } 
    45         return geometry; 
    46     }, 
    47  
    48     /** 
    49      * Serialize a geometry or array of geometries into a WKT string. 
    50      * @param {OpenLayers.Geometry|Array} geom A geometry or array of geometries 
     44                features = this.parse[type].apply(this, [str]); 
     45            } 
     46        } 
     47        return features; 
     48    }, 
     49 
     50    /** 
     51     * Serialize a feature or array of features into a WKT string. 
     52     * @param {OpenLayers.Feature.Vector|Array} features A feature or array of 
     53     *                                                   features 
    5154     * @returns {String} The WKT string representation of the input geometries 
    5255     */ 
    53     write: function(geom) { 
     56    write: function(features) { 
    5457        var collection, geometry, type, data, isCollection; 
    55         if(geom.constructor == Array) { 
    56             collection = geom
     58        if(features.constructor == Array) { 
     59            collection = features
    5760            isCollection = true; 
    5861        } else { 
    59             collection = [geom]; 
     62            collection = [features]; 
    6063            isCollection = false; 
    6164        } 
     
    6871                pieces.push(','); 
    6972            } 
    70             geometry = collection[i]
     73            geometry = collection[i].geometry
    7174            type = geometry.CLASS_NAME.split('.')[2].toLowerCase(); 
    7275            if(!this.extract[type]) { 
     
    179182    parse: { 
    180183        /** 
    181          * Return point geometry given a point WKT fragment. 
     184         * Return point feature given a point WKT fragment. 
    182185         * @param {String} str A WKT fragment representing the point 
    183          * @returns {OpenLayers.Geometry.Point} A point geometry 
     186         * @returns {OpenLayers.Feature.Vector} A point feature 
     187         * @private 
    184188         */ 
    185189        'point': function(str) { 
    186190            var coords = str.trim().split(this.regExes.spaces); 
    187             return new OpenLayers.Geometry.Point(coords[0], coords[1]); 
    188         }, 
    189  
    190         /** 
    191          * Return a multipoint geometry given a multipoint WKT fragment. 
     191            return new OpenLayers.Feature.Vector( 
     192                new OpenLayers.Geometry.Point(coords[0], coords[1]) 
     193            ); 
     194        }, 
     195 
     196        /** 
     197         * Return a multipoint feature given a multipoint WKT fragment. 
    192198         * @param {String} A WKT fragment representing the multipoint 
    193          * @returns {OpenLayers.Geometry.MultiPoint} A multipoint geometry 
     199         * @returns {OpenLayers.Feature.Vector} A multipoint feature 
     200         * @private 
    194201         */ 
    195202        'multipoint': function(str) { 
     
    197204            var components = []; 
    198205            for(var i=0; i<points.length; ++i) { 
    199                 components.push(this.parse.point.apply(this, [points[i]])); 
    200             } 
    201             return new OpenLayers.Geometry.MultiPoint(components); 
     206                components.push(this.parse.point.apply(this, [points[i]]).geometry); 
     207            } 
     208            return new OpenLayers.Feature.Vector( 
     209                new OpenLayers.Geometry.MultiPoint(components) 
     210            ); 
    202211        }, 
    203212         
    204213        /** 
    205          * Return a linestring geometry given a linestring WKT fragment. 
     214         * Return a linestring feature given a linestring WKT fragment. 
    206215         * @param {String} A WKT fragment representing the linestring 
    207          * @returns {OpenLayers.Geometry.LineString} A linestring geometry 
     216         * @returns {OpenLayers.Feature.Vector} A linestring feature 
     217         * @private 
    208218         */ 
    209219        'linestring': function(str) { 
     
    211221            var components = []; 
    212222            for(var i=0; i<points.length; ++i) { 
    213                 components.push(this.parse.point.apply(this, [points[i]])); 
    214             } 
    215             return new OpenLayers.Geometry.LineString(components); 
    216         }, 
    217  
    218         /** 
    219          * Return a multilinestring geometry given a multilinestring WKT fragment. 
     223                components.push(this.parse.point.apply(this, [points[i]]).geometry); 
     224            } 
     225            console.log(components); 
     226            return new OpenLayers.Feature.Vector( 
     227                new OpenLayers.Geometry.LineString(components) 
     228            ); 
     229        }, 
     230 
     231        /** 
     232         * Return a multilinestring feature given a multilinestring WKT fragment. 
    220233         * @param {String} A WKT fragment representing the multilinestring 
    221          * @returns {OpenLayers.Geometry.LineString} A multilinestring geometry 
     234         * @returns {OpenLayers.Feature.Vector} A multilinestring feature 
     235         * @private 
    222236         */ 
    223237        'multilinestring': function(str) { 
     
    227241            for(var i=0; i<lines.length; ++i) { 
    228242                line = lines[i].replace(this.regExes.trimParens, '$1'); 
    229                 components.push(this.parse.linestring.apply(this, [line])); 
    230             } 
    231             return new OpenLayers.Geometry.MultiLineString(components); 
     243                components.push(this.parse.linestring.apply(this, [line]).geometry); 
     244            } 
     245            return new OpenLayers.Feature.Vector( 
     246                new OpenLayers.Geometry.MultiLineString(components) 
     247            ); 
    232248        }, 
    233249         
    234250        /** 
    235          * Return a polygon geometry given a polygon WKT fragment. 
     251         * Return a polygon feature given a polygon WKT fragment. 
    236252         * @param {String} A WKT fragment representing the polygon 
    237          * @returns {OpenLayers.Geometry.Polygon} A polygon geometry 
     253         * @returns {OpenLayers.Feature.Vector} A polygon feature 
     254         * @private 
    238255         */ 
    239256        'polygon': function(str) { 
     
    243260            for(var i=0; i<rings.length; ++i) { 
    244261                ring = rings[i].replace(this.regExes.trimParens, '$1'); 
    245                 linestring = this.parse.linestring.apply(this, [ring])
    246                 linearring = new OpenLayers.Geometry.LinearRing(linestring.components); 
     262                linestring = this.parse.linestring.apply(this, [ring]).geometry
     263                linearring = new OpenLayers.Geometry.LinearRing(linestring.components) 
    247264                components.push(linearring); 
    248265            } 
    249             return new OpenLayers.Geometry.Polygon(components); 
    250         }, 
    251  
    252         /** 
    253          * Return a multipolygon geometry given a multipolygon WKT fragment. 
     266            return new OpenLayers.Feature.Vector( 
     267                new OpenLayers.Geometry.Polygon(components) 
     268            ); 
     269        }, 
     270 
     271        /** 
     272         * Return a multipolygon feature given a multipolygon WKT fragment. 
    254273         * @param {String} A WKT fragment representing the multipolygon 
    255          * @returns {OpenLayers.Geometry.MultiPolygon} A multipolygon geometry 
     274         * @returns {OpenLayers.Feature.Vector} A multipolygon feature 
     275         * @private 
    256276         */ 
    257277        'multipolygon': function(str) { 
     
    261281            for(var i=0; i<polygons.length; ++i) { 
    262282                polygon = polygons[i].replace(this.regExes.trimParens, '$1'); 
    263                 components.push(this.parse.polygon.apply(this, [polygon])); 
    264             } 
    265             return new OpenLayers.Geometry.MultiPolygon(components); 
    266         }, 
    267  
    268         /** 
    269          * Return an array of geometries given a geometrycollection WKT fragment. 
     283                components.push(this.parse.polygon.apply(this, [polygon]).geometry); 
     284            } 
     285            return new OpenLayers.Feature.Vector( 
     286                new OpenLayers.Geometry.MultiPolygon(components) 
     287            ); 
     288        }, 
     289 
     290        /** 
     291         * Return an array of features given a geometrycollection WKT fragment. 
    270292         * @param {String} A WKT fragment representing the geometrycollection 
    271          * @returns {Array} An array of OpenLayers.Geometry 
     293         * @returns {Array} An array of OpenLayers.Feature.Vector 
     294         * @private 
    272295         */ 
    273296        'geometrycollection': function(str) { 
  • trunk/openlayers/lib/OpenLayers/Geometry.js

    r3043 r3158  
    66 * @class 
    77 * @requires OpenLayers/Format/WKT.js 
     8 * @requires OpenLayers/Feature/Vector.js 
    89 */ 
    910OpenLayers.Geometry = OpenLayers.Class.create(); 
     
    151152     */ 
    152153    toString: function() { 
    153        return OpenLayers.Format.WKT.prototype.write(this); 
     154        return OpenLayers.Format.WKT.prototype.write( 
     155            new OpenLayers.Feature.Vector(this) 
     156        ); 
    154157    }, 
    155158 
  • trunk/openlayers/tests/Format/test_WKT.html

    r2978 r3158  
    66    var points = [];  
    77    for(var i=0; i<12; ++i) {  
    8         points.push(new OpenLayers.Geometry.Point(Math.random() * 100,  
    9                                                   Math.random() * 100));  
     8        points.push(new OpenLayers.Feature.Vector( 
     9            new OpenLayers.Geometry.Point(Math.random() * 100, 
     10                                          Math.random() * 100)) 
     11        );  
    1012    }  
    11     var multipoint = new OpenLayers.Geometry.MultiPoint([  
    12         points[0], points[1], points[2]  
    13     ]);  
     13    var multipoint = new OpenLayers.Feature.Vector( 
     14        new OpenLayers.Geometry.MultiPoint([  
     15            points[0].geometry, points[1].geometry, points[2].geometry 
     16        ]) 
     17    );  
    1418      
    1519    var linestrings = [  
    16         new OpenLayers.Geometry.LineString([points[0], points[1], points[2]]),  
    17         new OpenLayers.Geometry.LineString([points[3], points[4], points[5]])  
     20        new OpenLayers.Feature.Vector( 
     21            new OpenLayers.Geometry.LineString([points[0].geometry, points[1].geometry, points[2].geometry]) 
     22        ),  
     23        new OpenLayers.Feature.Vector( 
     24            new OpenLayers.Geometry.LineString([points[3].geometry, points[4].geometry, points[5].geometry]) 
     25        ) 
    1826    ];  
    1927      
    20     var multilinestring = new OpenLayers.Geometry.MultiLineString([  
    21         linestrings[0], linestrings[1]  
    22     ]);  
     28    var multilinestring = new OpenLayers.Feature.Vector( 
     29        new OpenLayers.Geometry.MultiLineString([  
     30            linestrings[0].geometry, linestrings[1].geometry 
     31        ]) 
     32    );  
    2333  
    2434    var rings = [  
    25         new OpenLayers.Geometry.LinearRing([points[0], points[1], points[2]]),  
    26         new OpenLayers.Geometry.LinearRing([points[3], points[4], points[5]]),  
    27         new OpenLayers.Geometry.LinearRing([points[6], points[7], points[8]]),  
    28         new OpenLayers.Geometry.LinearRing([points[9], points[10], points[11]])  
     35        new OpenLayers.Geometry.LinearRing([points[0].geometry, points[1].geometry, points[2].geometry]),  
     36        new OpenLayers.Geometry.LinearRing([points[3].geometry, points[4].geometry, points[5].geometry]),  
     37        new OpenLayers.Geometry.LinearRing([points[6].geometry, points[7].geometry, points[8].geometry]),  
     38        new OpenLayers.Geometry.LinearRing([points[9].geometry, points[10].geometry, points[11].geometry])  
    2939    ];  
    3040  
    3141    var polygons = [  
    32         new OpenLayers.Geometry.Polygon([rings[0], rings[1]]),  
    33         new OpenLayers.Geometry.Polygon([rings[2], rings[3]])  
     42        new OpenLayers.Feature.Vector( 
     43            new OpenLayers.Geometry.Polygon([rings[0], rings[1]]) 
     44        ),  
     45        new OpenLayers.Feature.Vector( 
     46            new OpenLayers.Geometry.Polygon([rings[2], rings[3]]) 
     47        ) 
    3448    ];  
    3549      
    36     var multipolygon = new OpenLayers.Geometry.MultiPolygon([  
    37         polygons[0], polygons[1]  
    38     ]);  
     50    var multipolygon = new OpenLayers.Feature.Vector( 
     51        new OpenLayers.Geometry.MultiPolygon([  
     52            polygons[0].geometry, polygons[1].geometry  
     53        ]) 
     54    );  
    3955      
    4056    var collection = [points[0], linestrings[0]];  
     
    5470        t.plan(7);  
    5571        var format = new OpenLayers.Format.WKT();  
    56           
     72 
    5773        // test a point  
    5874        t.eq(format.write(points[0]),  
    59              "POINT(" + points[0].x + " " + points[0].y + ")",  
     75             "POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")",  
    6076             "format correctly writes Point WKT");  
    6177  
    6278        // test a multipoint  
    6379        t.eq(format.write(multipoint),  
    64              "MULTIPOINT(" + points[0].x + " " + points[0].y + "," +  
    65                              points[1].x + " " + points[1].y + "," +  
    66                              points[2].x + " " + points[2].y + ")",  
     80             "MULTIPOINT(" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     81                             points[1].geometry.x + " " + points[1].geometry.y + "," +  
     82                             points[2].geometry.x + " " + points[2].geometry.y + ")",  
    6783             "format correctly writes MultiPoint WKT");  
    6884  
    6985        // test a linestring  
    7086        t.eq(format.write(linestrings[0]),  
    71              "LINESTRING(" + points[0].x + " " + points[0].y + "," +  
    72                              points[1].x + " " + points[1].y + "," +  
    73                              points[2].x + " " + points[2].y + ")",  
     87             "LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     88                             points[1].geometry.x + " " + points[1].geometry.y + "," +  
     89                             points[2].geometry.x + " " + points[2].geometry.y + ")",  
    7490             "format correctly writes LineString WKT");  
    7591  
    7692        // test a multilinestring  
    7793        t.eq(format.write(multilinestring),  
    78              "MULTILINESTRING((" + points[0].x + " " + points[0].y + "," +  
    79                                    points[1].x + " " + points[1].y + "," +  
    80                                    points[2].x + " " + points[2].y + ")," +  
    81                              "(" + points[3].x + " " + points[3].y + "," +  
    82                                    points[4].x + " " + points[4].y + "," +  
    83                                    points[5].x + " " + points[5].y + "))",  
     94             "MULTILINESTRING((" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     95                                   points[1].geometry.x + " " + points[1].geometry.y + "," +  
     96                                   points[2].geometry.x + " " + points[2].geometry.y + ")," +  
     97                             "(" + points[3].geometry.x + " " + points[3].geometry.y + "," +  
     98                                   points[4].geometry.x + " " + points[4].geometry.y + "," +  
     99                                   points[5].geometry.x + " " + points[5].geometry.y + "))",  
    84100             "format correctly writes MultiLineString WKT");  
    85101  
    86102        // test a polygon  
    87103        t.eq(format.write(polygons[0]),  
    88              "POLYGON((" + points[0].x + " " + points[0].y + "," +  
    89                            points[1].x + " " + points[1].y + "," +  
    90                            points[2].x + " " + points[2].y + "," +  
    91                            points[0].x + " " + points[0].y + ")," +  
    92                      "(" + points[3].x + " " + points[3].y + "," +  
    93                            points[4].x + " " + points[4].y + "," +  
    94                            points[5].x + " " + points[5].y + "," +  
    95                            points[3].x + " " + points[3].y + "))",  
     104             "POLYGON((" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     105                           points[1].geometry.x + " " + points[1].geometry.y + "," +  
     106                           points[2].geometry.x + " " + points[2].geometry.y + "," +  
     107                           points[0].geometry.x + " " + points[0].geometry.y + ")," +  
     108                     "(" + points[3].geometry.x + " " + points[3].geometry.y + "," +  
     109                           points[4].geometry.x + " " + points[4].geometry.y + "," +  
     110                           points[5].geometry.x + " " + points[5].geometry.y + "," +  
     111                           points[3].geometry.x + " " + points[3].geometry.y + "))",  
    96112             "format correctly writes Polygon WKT");  
    97113  
    98114        // test a multipolygon  
    99115        t.eq(format.write(multipolygon),  
    100              "MULTIPOLYGON(((" + points[0].x + " " + points[0].y + "," +  
    101                                  points[1].x + " " + points[1].y + "," +  
    102                                  points[2].x + " " + points[2].y + "," +  
    103                                  points[0].x + " " + points[0].y + ")," +  
    104                            "(" + points[3].x + " " + points[3].y + "," +  
    105                                  points[4].x + " " + points[4].y + "," +  
    106                                  points[5].x + " " + points[5].y + "," +  
    107                                  points[3].x + " " + points[3].y + "))," +  
    108                           "((" + points[6].x + " " + points[6].y + "," +  
    109                                  points[7].x + " " + points[7].y + "," +  
    110                                  points[8].x + " " + points[8].y + "," +  
    111                                  points[6].x + " " + points[6].y + ")," +  
    112                            "(" + points[9].x + " " + points[9].y + "," +  
    113                                  points[10].x + " " + points[10].y + "," +  
    114                                  points[11].x + " " + points[11].y + "," +  
    115                                  points[9].x + " " + points[9].y + ")))",  
     116             "MULTIPOLYGON(((" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     117                                 points[1].geometry.x + " " + points[1].geometry.y + "," +  
     118                                 points[2].geometry.x + " " + points[2].geometry.y + "," +  
     119                                 points[0].geometry.x + " " + points[0].geometry.y + ")," +  
     120                           "(" + points[3].geometry.x + " " + points[3].geometry.y + "," +  
     121                                 points[4].geometry.x + " " + points[4].geometry.y + "," +  
     122                                 points[5].geometry.x + " " + points[5].geometry.y + "," +  
     123                                 points[3].geometry.x + " " + points[3].geometry.y + "))," +  
     124                          "((" + points[6].geometry.x + " " + points[6].geometry.y + "," +  
     125                                 points[7].geometry.x + " " + points[7].geometry.y + "," +  
     126                                 points[8].geometry.x + " " + points[8].geometry.y + "," +  
     127                                 points[6].geometry.x + " " + points[6].geometry.y + ")," +  
     128                           "(" + points[9].geometry.x + " " + points[9].geometry.y + "," +  
     129                                 points[10].geometry.x + " " + points[10].geometry.y + "," +  
     130                                 points[11].geometry.x + " " + points[11].geometry.y + "," +  
     131                                 points[9].geometry.x + " " + points[9].geometry.y + ")))",  
    116132             "format correctly writes MultiPolygon WKT");  
    117133          
    118134        // test a geometrycollection  
    119135        t.eq(format.write(collection),  
    120              "GEOMETRYCOLLECTION(POINT(" + points[0].x + " " + points[0].y + ")," +  
    121                                 "LINESTRING(" + points[0].x + " " + points[0].y + "," +  
    122                                                 points[1].x + " " + points[1].y + "," +  
    123                                                 points[2].x + " " + points[2].y + "))",  
     136             "GEOMETRYCOLLECTION(POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")," +  
     137                                "LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     138                                                points[1].geometry.x + " " + points[1].geometry.y + "," +  
     139                                                points[2].geometry.x + " " + points[2].geometry.y + "))",  
    124140             "format correctly writes GeometryCollection WKT");  
    125141  
     
    135151  
    136152        // test a point  
    137         t.ok(points[0].equals(format.read(format.write(points[0]))),  
     153        t.ok(points[0].geometry.equals(format.read(format.write(points[0])).geometry),  
    138154             "format correctly reads Point WKT");  
    139   
     155 
    140156        // test a multipoint  
    141         t.ok(multipoint.equals(format.read(format.write(multipoint))),  
     157        t.ok(multipoint.geometry.equals(format.read(format.write(multipoint)).geometry),  
    142158             "format correctly reads MultiPoint WKT");  
    143159  
    144160        // test a linestring  
    145         t.ok(linestrings[0].equals(format.read(format.write(linestrings[0]))),  
     161        t.ok(linestrings[0].geometry.equals(format.read(format.write(linestrings[0])).geometry),  
    146162             "format correctly reads LineString WKT");  
    147163  
    148164        // test a multilinestring  
    149         t.ok(multilinestring.equals(format.read(format.write(multilinestring))),  
     165        t.ok(multilinestring.geometry.equals(format.read(format.write(multilinestring)).geometry),  
    150166             "format correctly reads MultiLineString WKT");  
    151167  
    152168        // test a polygon  
    153         t.ok(polygons[0].equals(format.read(format.write(polygons[0]))),  
     169        t.ok(polygons[0].geometry.equals(format.read(format.write(polygons[0])).geometry),  
    154170             "format correctly reads Polygon WKT");  
    155171  
    156172        // test a multipolygon  
    157         t.ok(multipolygon.equals(format.read(format.write(multipolygon))),  
     173        t.ok(multipolygon.geometry.equals(format.read(format.write(multipolygon)).geometry),  
    158174             "format correctly reads MultiPolygon WKT");  
    159175          
    160176        // test a geometrycollection  
    161177        t.eq(format.write(collection),  
    162              "GEOMETRYCOLLECTION(POINT(" + points[0].x + " " + points[0].y + ")," +  
    163                                 "LINESTRING(" + points[0].x + " " + points[0].y + "," +  
    164                                                 points[1].x + " " + points[1].y + "," +  
    165                                                 points[2].x + " " + points[2].y + "))",  
     178             "GEOMETRYCOLLECTION(POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")," +  
     179                                "LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     180                                                points[1].geometry.x + " " + points[1].geometry.y + "," +  
     181                                                points[2].geometry.x + " " + points[2].geometry.y + "))",  
    166182             "format correctly writes GeometryCollection WKT");  
    167183