Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm going through GeoDjango basics right now. Ideally, I'd like to publish a GeoRSS from a set of data I have that is already in Django's database. I know how to get a regular Feed working, but when I try GeoRSSFeed, I'm running into problems. One of my main problems is:

Exception Value: __init__() takes at least 4 arguments (1 given)

In reference to my urls.py file when I try to make my Feed to GeoRSSFeed. Is there no tutorial for getting GeoRSSFeeds to work? I've seen this but it really isn't helping me.

share|improve this question
    
Can you provide more detail? What's in the relevant part of your urls.py? Have you subclassed the feed to let it know you have a GeoRSS feed? –  scw Mar 23 '11 at 14:31
    

1 Answer 1

up vote 2 down vote accepted

Looking at the code it appears that the django.contrib.gis.feeds depends on a deprecated version of the Django syndication framework.

Reported as https://code.djangoproject.com/ticket/17782

It's possible to work around the issue as the Geodjango feed generators still seem to work. Here's an example:

from django.contrib.syndication.views import Feed
from django.contrib.gis.feeds import GeoRSSFeed

class MyGeoFeed(Feed):
    """ Example feed working around https://code.djangoproject.com/ticket/17782
    Note that the geoetry and item_geometry must be instance methods and not
    class attributes.
    """
    feed_type = GeoRSSFeed

    def feed_extra_kwargs(self, obj):
        return {'geometry' : self.geometry(obj)}

    def item_extra_kwargs(self, item):
        return {'geometry' : self.item_geometry(item)}

    def geometry(self, obj):
        # Return geos object as per geodjango docs

    def item_geometry(self, item):
        # Return geos object as per geodjango docs

    # Other feed methods as per django syndication docs.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.