OpenLayers OpenLayers

Ticket #973: georss.2.patch

File georss.2.patch, 22.3 kB (added by tschaub, 1 year ago)

read/write georss

  • tests/Format/test_GeoRSS.html

    old new  
    1818    function test_Format_GeoRSS_serializeline(t) {  
    1919        t.plan(1); 
    2020 
    21         if (OpenLayers.Util.getBrowserName() == "msie") { 
    22             //serialization currently not supported in IE 
    23             t.ok(true, "GeoRSS serialization not currently supported in IE"); 
    24         } else { 
    25             var parser = new OpenLayers.Format.GeoRSS(); 
    26             var point = new OpenLayers.Geometry.Point(-111.04, 45.68);   
    27             var point2 = new OpenLayers.Geometry.Point(-112.04, 45.68);  
    28             var l = new OpenLayers.Geometry.LineString([point, point2]); 
    29             var f = new OpenLayers.Feature.Vector(l); 
    30             var data = parser.write([f]); 
    31             t.eq(data.firstChild.childNodes[2].firstChild.nodeValue, '45.68 -111.04 45.68 -112.04 ', 'GeoRSS serializes a line correctly'); 
     21        var parser = new OpenLayers.Format.GeoRSS(); 
     22        var point = new OpenLayers.Geometry.Point(-111.04, 45.68);   
     23        var point2 = new OpenLayers.Geometry.Point(-112.04, 45.68);  
     24        var l = new OpenLayers.Geometry.LineString([point, point2]); 
     25        var f = new OpenLayers.Feature.Vector(l); 
     26        var data = parser.write([f]); 
     27        t.eq(data, '<rss xmlns="http://backend.userland.com/rss2"><item><title></title><description></description><georss:line xmlns:georss="http://www.georss.org/georss">45.68 -111.04 45.68 -112.04</georss:line></item></rss>', 'GeoRSS serializes a line correctly'); 
     28    } 
     29    function test_Format_GeoRSS_roundtrip(t) { 
     30        t.plan(input.length); 
     31        var parser = new OpenLayers.Format.GeoRSS(); 
     32        for(var i=0; i < input.length; i++) { 
     33            var feed = shell_start+input[i]+shell_end; 
     34            var data = parser.read(feed); 
     35            var out = parser.write(data); 
     36            t.eq(out, output[i], "Output gave expected value"); 
    3237        } 
    3338    } 
     39              
     40    var shell_start = '<feed xmlns="http://www.w3.org/2005/Atom" \n              xmlns:georss="http://www.georss.org/georss">\n              <title>scribble</title>\n              <id>http://featureserver.org/featureserver.cgi/scribble?format=atom</id>\n              <author><name>FeatureServer</name></author>\n';              
     41    var shell_end = '</feed>';  
     42    var input = ['<entry><id>http://featureserver.org/featureserver.cgi/scribble/562.atom</id><link href="http://featureserver.org/featureserver.cgi/scribble/562.atom"/><title>Feature 2</title><content type="html">&lt;b&gt;strokeColor&lt;/b&gt;: red&lt;br /&gt;&lt;b&gt;title&lt;/b&gt;: Feature 2&lt;br /&gt;&lt;b&gt;author&lt;/b&gt;: Your Name Here</content><georss:polygon>-5.9765625 -131.484375 -58.0078125 -112.5 -50.2734375 -32.34375 52.3828125 -114.609375 -35.5078125 -167.34375 -57.3046875 -146.953125 -34.1015625 -139.921875 -5.9765625 -131.484375</georss:polygon></entry>', 
     43    '<entry><id>http://featureserver.org/featureserver.cgi/scribble/796.atom</id><link href="http://featureserver.org/featureserver.cgi/scribble/796.atom"/><title>Feature 2</title><content type="html">&lt;b&gt;strokeColor&lt;/b&gt;: 00ccff&lt;br /&gt;&lt;b&gt;title&lt;/b&gt;: Feature 2&lt;br /&gt;&lt;b&gt;author&lt;/b&gt;: Your Name Here</content><georss:point>75.5859375 15.46875</georss:point></entry>', 
     44    '<entry><id>http://featureserver.org/featureserver.cgi/scribble/794.atom</id><link href="http://featureserver.org/featureserver.cgi/scribble/794.atom"/><title>Feature 5</title><content type="html">&lt;b&gt;strokeColor&lt;/b&gt;: red&lt;br /&gt;&lt;b&gt;title&lt;/b&gt;: Feature 5&lt;br /&gt;&lt;b&gt;author&lt;/b&gt;: Your Name Here</content><georss:line>28.828125 32.6953125 49.921875 34.8046875 39.375 58.0078125 39.375 58.0078125 40.078125 58.0078125 41.484375 58.0078125 43.59375 58.0078125 45.703125 58.7109375 47.8125 58.7109375 49.21875 58.7109375 51.328125 59.4140625 52.03125 59.4140625 54.140625 60.8203125 56.25 61.5234375 56.25 62.2265625 57.65625 62.2265625 57.65625 62.9296875 58.359375 63.6328125 58.359375 65.0390625 58.359375 65.7421875 59.0625 66.4453125 59.0625 67.1484375 59.0625 68.5546875 59.765625 69.9609375 59.765625 72.0703125 59.765625 73.4765625 59.765625 76.2890625 59.765625 78.3984375 59.765625 79.8046875 59.765625 81.9140625 59.765625 83.3203125 59.0625 84.7265625 59.0625 86.8359375 58.359375 87.5390625 58.359375 88.2421875 56.953125 89.6484375 56.25 91.0546875 54.84375 93.8671875 52.03125 96.6796875 51.328125 98.7890625 50.625 100.1953125 49.21875 102.3046875 48.515625 103.7109375 47.8125 104.4140625 47.109375 105.8203125 46.40625 106.5234375 46.40625 107.9296875 45.703125 109.3359375 45 110.7421875 43.59375 112.8515625 43.59375 114.2578125 43.59375 114.9609375 42.890625 117.0703125 42.890625 117.7734375 42.1875 118.4765625 42.1875 119.1796875 42.1875 119.8828125</georss:line></entry>'  
     45    ]; 
     46    var output= ['<rss xmlns="http://backend.userland.com/rss2"><item><title>Feature 2</title><description>&lt;b&gt;strokeColor&lt;/b&gt;: red&lt;br /&gt;&lt;b&gt;title&lt;/b&gt;: Feature 2&lt;br /&gt;&lt;b&gt;author&lt;/b&gt;: Your Name Here</description><link>http://featureserver.org/featureserver.cgi/scribble/562.atom</link><georss:polygon xmlns:georss="http://www.georss.org/georss">-5.9765625 -131.484375 -58.0078125 -112.5 -50.2734375 -32.34375 52.3828125 -114.609375 -35.5078125 -167.34375 -57.3046875 -146.953125 -34.1015625 -139.921875 -5.9765625 -131.484375</georss:polygon></item></rss>', 
     47   '<rss xmlns="http://backend.userland.com/rss2"><item><title>Feature 2</title><description>&lt;b&gt;strokeColor&lt;/b&gt;: 00ccff&lt;br /&gt;&lt;b&gt;title&lt;/b&gt;: Feature 2&lt;br /&gt;&lt;b&gt;author&lt;/b&gt;: Your Name Here</description><link>http://featureserver.org/featureserver.cgi/scribble/796.atom</link><georss:point xmlns:georss="http://www.georss.org/georss">75.5859375 15.46875</georss:point></item></rss>', 
     48   '<rss xmlns="http://backend.userland.com/rss2"><item><title>Feature 5</title><description>&lt;b&gt;strokeColor&lt;/b&gt;: red&lt;br /&gt;&lt;b&gt;title&lt;/b&gt;: Feature 5&lt;br /&gt;&lt;b&gt;author&lt;/b&gt;: Your Name Here</description><link>http://featureserver.org/featureserver.cgi/scribble/794.atom</link><georss:line xmlns:georss="http://www.georss.org/georss">28.828125 32.6953125 49.921875 34.8046875 39.375 58.0078125 39.375 58.0078125 40.078125 58.0078125 41.484375 58.0078125 43.59375 58.0078125 45.703125 58.7109375 47.8125 58.7109375 49.21875 58.7109375 51.328125 59.4140625 52.03125 59.4140625 54.140625 60.8203125 56.25 61.5234375 56.25 62.2265625 57.65625 62.2265625 57.65625 62.9296875 58.359375 63.6328125 58.359375 65.0390625 58.359375 65.7421875 59.0625 66.4453125 59.0625 67.1484375 59.0625 68.5546875 59.765625 69.9609375 59.765625 72.0703125 59.765625 73.4765625 59.765625 76.2890625 59.765625 78.3984375 59.765625 79.8046875 59.765625 81.9140625 59.765625 83.3203125 59.0625 84.7265625 59.0625 86.8359375 58.359375 87.5390625 58.359375 88.2421875 56.953125 89.6484375 56.25 91.0546875 54.84375 93.8671875 52.03125 96.6796875 51.328125 98.7890625 50.625 100.1953125 49.21875 102.3046875 48.515625 103.7109375 47.8125 104.4140625 47.109375 105.8203125 46.40625 106.5234375 46.40625 107.9296875 45.703125 109.3359375 45 110.7421875 43.59375 112.8515625 43.59375 114.2578125 43.59375 114.9609375 42.890625 117.0703125 42.890625 117.7734375 42.1875 118.4765625 42.1875 119.1796875 42.1875 119.8828125</georss:line></item></rss>']; 
    3449 
    3550    </script>  
    3651</head>  
  • lib/OpenLayers/Format/GeoRSS.js

    old new  
    44 
    55/** 
    66 * @requires OpenLayers/Format.js 
     7 * @requires OpenLayers/Format/XML.js 
    78 * 
    89 * Class: OpenLayers.Format.GeoRSS 
    9  * Write-only GeoRSS. Create a new instance with the  
     10 * Read/write GeoRSS parser. Create a new instance with the  
    1011 *     <OpenLayers.Format.GeoRSS> constructor. 
    1112 * 
    1213 * Inherits from: 
    13  *  - <OpenLayers.Format
     14 *  - <OpenLayers.Format.XML
    1415 */ 
    15 OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format, { 
     16OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, { 
    1617     
    1718    /** 
    1819     * APIProperty: rssns 
    19      * RSS namespace to use. 
     20     * {String} RSS namespace to use. Defaults to 
     21     *   "http://backend.userland.com/rss2" 
    2022     */ 
    2123    rssns: "http://backend.userland.com/rss2", 
    2224     
    2325    /** 
    2426     * APIProperty: featurens 
    25      * Feature Attributes namespace 
     27     * {String} Feature Attributes namespace.  Defaults to 
     28     *    "http://mapserver.gis.umn.edu/mapserver" 
    2629     */ 
    2730    featureNS: "http://mapserver.gis.umn.edu/mapserver", 
    2831     
    2932    /** 
    3033     * APIProperty: georssns 
    31      * GeoRSS namespace to use. 
     34     * {String} GeoRSS namespace to use.  Defaults to 
     35     *     "http://www.georss.org/georss" 
    3236     */ 
    3337    georssns: "http://www.georss.org/georss", 
    3438     
     39    /** 
     40     * APIProperty: featureTitle 
     41     * {String} Default title for features.  Defaults to "Untitled" 
     42     */ 
     43    featureTitle: "Untitled", 
    3544     
    3645    /** 
     46     * APIProperty: featureDescription 
     47     * {String} Default description for features.  Defaults to "No Description" 
     48     */ 
     49    featureDescription: "No Description", 
     50     
     51    /** 
    3752     * Constructor: OpenLayers.Format.GeoRSS 
    38      * Create a new parser for GeoRSS 
     53     * Create a new parser for GeoRSS. 
    3954     * 
    4055     * Parameters: 
    4156     * options - {Object} An optional object whose properties will be set on 
    42      *                    this instance. 
     57     *     this instance. 
    4358     */ 
    4459    initialize: function(options) { 
    45         OpenLayers.Format.prototype.initialize.apply(this, [options]); 
     60        OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); 
    4661    }, 
     62     
     63    /** 
     64     * Method: createGeometryFromItem 
     65     * Return a geometry from a GeoRSS Item. 
     66     * 
     67     * Parameters: 
     68     * item - {DOMElement} A GeoRSS item node. 
     69     * 
     70     * Returns: 
     71     * {<OpenLayers.Geometry>} A geometry representing the node. 
     72     */ 
     73    createGeometryFromItem: function(item) { 
     74        var point = this.getElementsByTagNameNS(item, this.georssns, "point"); 
     75        var lat = this.getElementsByTagNameNS(item, this.geons, 'lat'); 
     76        var lon = this.getElementsByTagNameNS(item, this.geons, 'long'); 
     77         
     78        var line = this.getElementsByTagNameNS(item, 
     79                                                this.georssns, 
     80                                                "line"); 
     81        var polygon = this.getElementsByTagNameNS(item, 
     82                                                this.georssns, 
     83                                                "polygon"); 
     84         
     85        if (point.length > 0 || (lat.length > 0 && lon.length > 0)) { 
     86            if (point.length > 0) { 
     87                var location = OpenLayers.String.trim( 
     88                                point[0].firstChild.nodeValue).split(/\s+/); 
     89                 
     90                if (location.length !=2) { 
     91                    var location = OpenLayers.String.trim( 
     92                                point[0].firstChild.nodeValue).split(/\s*,\s*/); 
     93                } 
     94            } else { 
     95                var location = [parseFloat(lat[0].firstChild.nodeValue), 
     96                                parseFloat(lon[0].firstChild.nodeValue)]; 
     97            }     
     98            var geometry = new OpenLayers.Geometry.Point(parseFloat(location[1]), 
     99                                                     parseFloat(location[0])); 
     100        } else if (line.length > 0) { 
     101            var coords = OpenLayers.String.trim(line[0].firstChild.nodeValue).split(/\s+/); 
     102            var components = [];  
     103            for (var i=0; i < coords.length; i+=2) { 
     104                var point = new OpenLayers.Geometry.Point(parseFloat(coords[i+1]), parseFloat(coords[i])); 
     105                components.push(point); 
     106            } 
     107            geometry = new OpenLayers.Geometry.LineString(components); 
     108        } else if (polygon.length > 0) {  
     109            var coords = OpenLayers.String.trim(polygon[0].firstChild.nodeValue).split(/\s+/); 
     110            var components = [];  
     111            for (var i=0; i < coords.length; i+=2) { 
     112                var point = new OpenLayers.Geometry.Point(parseFloat(coords[i+1]), parseFloat(coords[i])); 
     113                components.push(point); 
     114            } 
     115            geometry = new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(components)]); 
     116        } 
     117        return geometry; 
     118    },         
    47119 
    48120    /** 
     121     * Method: createGeometryFromItem 
     122     * Return a feature from a GeoRSS Item. 
     123     * 
     124     * Parameters: 
     125     * item - {DOMElement} A GeoRSS item node. 
     126     * 
     127     * Returns: 
     128     * {<OpenLayers.Feature.Vector>} A feature representing the item. 
     129     */ 
     130    createFeatureFromItem: function(item) { 
     131        var geometry = this.createGeometryFromItem(item); 
     132        /* Provide defaults for title and description */ 
     133        var title = this.getChildValue(item, "*", "title", this.featureTitle); 
     134        
     135        /* First try RSS descriptions, then Atom summaries */ 
     136        var description = this.getChildValue( 
     137            item, "*", "description", 
     138            this.getChildValue(item, "*", "content", this.featureDescription) 
     139        ); 
     140 
     141        /* If no link URL is found in the first child node, try the 
     142           href attribute */ 
     143        var link = this.getChildValue(item, "*", "link"); 
     144        if(!link) { 
     145            try { 
     146                link = this.getElementsByTagNameNS(item, "*", "link")[0].getAttribute("href"); 
     147            } catch(e) { 
     148                link = null; 
     149            } 
     150        } 
     151 
     152        var id = this.getChildValue(item, "*", "id", null); 
     153         
     154        var data = { 
     155            "title": title, 
     156            "description": description, 
     157            "link": link 
     158        }; 
     159        var feature = new OpenLayers.Feature.Vector(geometry, data); 
     160        feature.fid = id; 
     161        return feature; 
     162    },         
     163     
     164    /** 
     165     * Method: getChildValue 
     166     * 
     167     * Parameters: 
     168     * node - {DOMElement} 
     169     * nsuri - {String} Child node namespace uri ("*" for any). 
     170     * name - {String} Child node name. 
     171     * def - {String} Optional string default to return if no child found. 
     172     * 
     173     * Returns: 
     174     * {String} The value of the first child with the given tag name.  Returns 
     175     *     default value or empty string if none found. 
     176     */ 
     177    getChildValue: function(node, nsuri, name, def) { 
     178        var value; 
     179        try { 
     180            value = this.getElementsByTagNameNS(node, nsuri, name)[0].firstChild.nodeValue; 
     181        } catch(e) { 
     182            value = (def == undefined) ? "" : def; 
     183        } 
     184        return value; 
     185    }, 
     186     
     187    /** 
     188     * APIMethod: read 
     189     * Return a list of features from a GeoRSS doc 
     190      
     191     * Parameters: 
     192     * data - {Element}  
     193     * 
     194     * Returns: 
     195     * An Array of <OpenLayers.Feature.Vector>s 
     196     */ 
     197    read: function(doc) { 
     198        if (typeof doc == "string") {  
     199            doc = OpenLayers.Format.XML.prototype.read.apply(this, [doc]); 
     200        } 
     201 
     202        /* Try RSS items first, then Atom entries */ 
     203        var itemlist = null; 
     204        itemlist = this.getElementsByTagNameNS(doc, '*', 'item'); 
     205        if (itemlist.length == 0) { 
     206            itemlist = this.getElementsByTagNameNS(doc, '*', 'entry'); 
     207        } 
     208         
     209        var numItems = itemlist.length; 
     210        var features = new Array(numItems); 
     211        for(var i=0; i<numItems; i++) { 
     212            features[i] = this.createFeatureFromItem(itemlist[i]); 
     213        } 
     214        return features; 
     215    }, 
     216     
     217 
     218    /** 
    49219     * APIMethod: write 
    50220     * Accept Feature Collection, and return a string.  
    51221     *  
    52222     * Parameters:  
    53223     * features - Array({<OpenLayers.Feature.Vector>}) List of features to serialize into a string. 
    54224     */ 
    55      write: function(features) { 
    56         var featureCollection = document.createElementNS(this.rssns, "rss"); 
    57         for (var i=0; i < features.length; i++) { 
    58             featureCollection.appendChild(this.createFeatureXML(features[i])); 
     225    write: function(features) { 
     226        var georss; 
     227        if(features instanceof Array) { 
     228            georss = this.createElementNS(this.rssns, "rss"); 
     229            for(var i=0; i < features.length; i++) { 
     230                georss.appendChild(this.createFeatureXML(features[i])); 
     231            } 
     232        } else { 
     233            georss = this.createFeatureXML(features); 
    59234        } 
    60         return featureCollection
    61     }, 
    62      
     235        return OpenLayers.Format.XML.prototype.write.apply(this, [georss])
     236    }, 
     237 
    63238    /** 
    64239     * Method: createFeatureXML 
    65240     * Accept an <OpenLayers.Feature.Vector>, and build a geometry for it. 
     
    72247     */ 
    73248    createFeatureXML: function(feature) { 
    74249        var geometryNode = this.buildGeometryNode(feature.geometry); 
    75         var featureNode = document.createElementNS(this.rssns, "item"); 
    76         var titleNode = document.createElementNS(this.rssns, "title"); 
    77         titleNode.appendChild(document.createTextNode(feature.attributes.title ? feature.attributes.title : "")); 
    78         var descNode = document.createElementNS(this.rssns, "description"); 
    79         descNode.appendChild(document.createTextNode(feature.attributes.description ? feature.attributes.description : "")); 
     250        var featureNode = this.createElementNS(this.rssns, "item"); 
     251        var titleNode = this.createElementNS(this.rssns, "title"); 
     252        titleNode.appendChild(this.createTextNode(feature.attributes.title ? feature.attributes.title : "")); 
     253        var descNode = this.createElementNS(this.rssns, "description"); 
     254        descNode.appendChild(this.createTextNode(feature.attributes.description ? feature.attributes.description : "")); 
    80255        featureNode.appendChild(titleNode); 
    81256        featureNode.appendChild(descNode); 
     257        if (feature.attributes.link) { 
     258            var linkNode = this.createElementNS(this.rssns, "link"); 
     259            linkNode.appendChild(this.createTextNode(feature.attributes.link)); 
     260            featureNode.appendChild(linkNode); 
     261        }     
    82262        for(var attr in feature.attributes) { 
    83             var attrText = document.createTextNode(feature.attributes[attr]);  
     263            if (attr == "link" || attr == "title" || attr == "description") { continue; }  
     264            var attrText = this.createTextNode(feature.attributes[attr]);  
    84265            var nodename = attr; 
    85266            if (attr.search(":") != -1) { 
    86267                nodename = attr.split(":")[1]; 
    87268            }     
    88             var attrContainer = document.createElementNS(this.featureNS, "feature:"+nodename); 
     269            var attrContainer = this.createElementNS(this.featureNS, "feature:"+nodename); 
    89270            attrContainer.appendChild(attrText); 
    90271            featureNode.appendChild(attrContainer); 
    91272        }     
     
    98279     * builds a GeoRSS node with a given geometry 
    99280     *  
    100281     * Parameters: 
    101      * geometry - {<OpenLayers.Geometry>}  
     282     * geometry - {<OpenLayers.Geometry>} 
     283     * 
     284     * Returns: 
     285     * {DOMElement} A gml node. 
    102286     */ 
    103287    buildGeometryNode: function(geometry) { 
    104         var gml = ""
    105         // match MultiPolygon or Polygon 
     288        var node
     289        // match Polygon 
    106290        if (geometry.CLASS_NAME == "OpenLayers.Geometry.Polygon") { 
    107                 gml = document.createElementNS(this.georssns, 'georss:polygon'); 
    108                  
    109                 gml.appendChild(this.buildCoordinatesNode(geometry.components[0])); 
    110            
    111         // match MultiLineString or LineString 
     291            node = this.createElementNS(this.georssns, 'georss:polygon'); 
     292             
     293            node.appendChild(this.buildCoordinatesNode(geometry.components[0])); 
     294       
     295        // match LineString 
    112296        else if (geometry.CLASS_NAME == "OpenLayers.Geometry.LineString") { 
    113                      gml = document.createElementNS(this.georssns, 'georss:line'); 
    114                       
    115                      gml.appendChild(this.buildCoordinatesNode(geometry)); 
    116                  
    117         // match MultiPoint or Point 
     297            node = this.createElementNS(this.georssns, 'georss:line'); 
     298             
     299            node.appendChild(this.buildCoordinatesNode(geometry)); 
     300       
     301        // match Point 
    118302        else if (geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { 
    119                 gml = document.createElementNS(this.georssns, 'georss:point'); 
    120                 gml.appendChild(this.buildCoordinatesNode(geometry)); 
    121         } else {     
    122           alert("Couldn't parse " + geometry.CLASS_NAME)
     303            node = this.createElementNS(this.georssns, 'georss:point'); 
     304            node.appendChild(this.buildCoordinatesNode(geometry)); 
     305        } else { 
     306            throw "Couldn't parse " + geometry.CLASS_NAME
    123307        }   
    124         return gml;          
     308        return node;          
    125309    }, 
    126310     
    127311    /**  
     
    137321            points = geometry.components; 
    138322        } 
    139323 
    140         var path = ""
     324        var path
    141325        if (points) { 
    142             for (var i = 0; i < points.length; i++) { 
    143                 path += points[i].y + " " + points[i].x + " "; 
     326            var numPoints = points.length; 
     327            var parts = new Array(numPoints); 
     328            for (var i = 0; i < numPoints; i++) { 
     329                parts[i] = points[i].y + " " + points[i].x; 
    144330            } 
     331            path = parts.join(" "); 
    145332        } else { 
    146            path += geometry.y + " " + geometry.x + " "
     333           path = geometry.y + " " + geometry.x
    147334        } 
    148         return document.createTextNode(path); 
     335        return this.createTextNode(path); 
    149336    }, 
    150337 
    151338    CLASS_NAME: "OpenLayers.Format.GeoRSS"  
  • examples/vector-formats.html

    old new  
    7777            formats = { 
    7878                wkt: new OpenLayers.Format.WKT(), 
    7979                geojson: new OpenLayers.Format.GeoJSON(), 
     80                georss: new OpenLayers.Format.GeoRSS(), 
    8081                gml: new OpenLayers.Format.GML(), 
    8182                kml: new OpenLayers.Format.KML() 
    8283            }; 
     
    147148            <select name="formatType" id="formatType"> 
    148149                <option value="geojson" selected="selected">GeoJSON</option> 
    149150                <option value="kml">KML</option> 
     151                <option value="georss">GeoRSS</option> 
    150152                <option value="gml">GML</option> 
    151153                <option value="wkt">Well-Known Text (WKT)</option> 
    152154            </select>