Created
October 8, 2009 10:02
-
-
Save andrewn/204909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OpenLayers.Format.GeoRSS.prototype.createFeatureFromItem: function(item) { | |
var geometry = this.createGeometryFromItem(item); | |
/* Provide defaults for title and description */ | |
var title = this.getChildValue(item, "*", "title", this.featureTitle); | |
/* First try RSS descriptions, then Atom summaries */ | |
var description = this.getChildValue( | |
item, "*", "description", | |
this.getChildValue(item, "*", "content", | |
this.getChildValue(item, "*", "summary", this.featureDescription))); | |
/* If no link URL is found in the first child node, try the | |
href attribute */ | |
var link = this.getChildValue(item, "*", "link"); | |
if(!link) { | |
try { | |
link = this.getElementsByTagNameNS(item, "*", "link")[0].getAttribute("href"); | |
} catch(e) { | |
link = null; | |
} | |
} | |
var id = this.getChildValue(item, "*", "id", null); | |
// Get the image url from the feed item | |
var url = this.getChildValue( item, "*", "image", null); | |
var data = { | |
"title": title, | |
"description": description, | |
"link": link, | |
"url": url // The url of the pinpoint image | |
}; | |
var feature = new OpenLayers.Feature.Vector(geometry, data); | |
feature.fid = id; | |
return feature; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment