On Jul 22, 2010, at 1:27 PM, Michael Lenahan wrote: > Hi there - I'm looking to find ways to get CouchDB to serve georss (in this > case, a point with latitude and longitude). > > I'm taking sofa as my starting point, because it has atom feed capability > built in. > > So, sofa can generate this: > http://mick.couchone.com/blog/_design/sofa/_list/index/recent-posts?descending=true&limit=10&format=atom > > In the couchapp files on my local machine I'm looking to amend > sofa/lists/index.js so that the feed entry includes georss:point as > specified here: > http://www.georss.org/simple#Point > > Currently the relevant part of sofa/lists/index.js looks like this: > > // generate the entry for this row > var feedEntry = Atom.entry({ > entry_id : > path.absolute('/'+encodeURIComponent(req.info.db_name)+'/'+encodeURIComponent( > row.id)), > title : row.value.title, > content : html, > updated : new Date(row.value.created_at), > author : row.value.author, > alternate : path.absolute(path.show('post', row.id)) > }); >
you will need to modify atom.js to add the proper xml to the output. http://github.com/jchris/sofa/blob/master/vendor/couchapp/lib/atom.js#L32 You should just copy this to your app's lib folder (I probably never should have put it in vendor in the first place, no other app uses it, I think). I don't know geo rss well enough but if it indeed RSS not Atom you will probably need to use atom.js as a starting point to write your own XML generator. > Has anyone out there done this already? Specifically I wonder how to handle > the fact of georss:point containing a colon and getting that to work in the > js file. > > Also - apologies if this is a dumb question - is it simply a matter of > including latitude and longitude in my couchdb database, then concatenating > these at the correct position in this js file - > > georss:point : row.value.latitude + ' ' + row.value.longitude > for this, you can quote the keys, like: "georss:point" > - or are there other things I need to consider before referencing these db > elements? > > Thanks! > > Michael
