Hello,

I'm trying to subclass OpenLayers.Format.GeoRSS; this is because I want to 
extract additional information from a GeoRSS feed that is not parsed with 
OpenLayers.Format.GeoRSS, such as geo:dir.

I've started a test subclass, doesn't do anything yet, for testing purposes 
only:

OpenLayers.Format.GeoRSSExt = OpenLayers.Class (OpenLayers.Format.GeoRSS,
    {
        initialize: function(options)
        {
            OpenLayers.Format.GeoRSS.prototype.initialize.apply
                (this,arguments);
        },

        createFeatureFromItem: function (item)
        {
            OpenLayers.Format.GeoRSS.prototype.createFeatureFromItem.apply
                    (this,arguments);
            alert('Title='+
                    this.getChildValue(item,"*","title","notitle"));
        },

        CLASS_NAME: "OpenLayers.Format.GeoRSSExt"

    }
);

As can be seen, for the moment the overridden createFeatureFromItem() simply 
displays an alert box with the feature title. This works correctly - the title 
is displayed - but the items are not added to the vector layer (code as below, 
the code below works correctly when I just use a straight 
OpenLayers.Format.GeoRSS()):

  georss = new OpenLayers.Layer.Vector
                    ("OTV Panoramas",
                        { strategies: [new OpenLayers.Strategy.BBOX()],
                        protocol: new OpenLayers.Protocol.HTTP 
                            ({ url: "/otv/rss.php",
                              format: new OpenLayers.Format.GeoRSSExt() }),
                          'styleMap' : sm,
                          'projection': wgs84
                         } );

The specific error I get is "features[i] not defined" in line 1698 of the 
current release version (2.9) of OpenLayers.js.

Any ideas what I'm doing wrong here? As far as I can ascertain I am using the 
correct current way to subclass.

Thanks,
Nick
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to