Show
Ignore:
Timestamp:
03/24/07 22:13:41 (3 years ago)
Author:
seang
Message:

Changed GeoRSS typename to 'entries'

Location:
PCL/branches/PCL-newfeatureapi/PCL-GeoRSS
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • PCL/branches/PCL-newfeatureapi/PCL-GeoRSS/cartography/data/georss.py

    r645 r647  
    228228            self._document = feedparser.parse(s.read()) 
    229229 
    230     def featuretype(self, typename='feed'): 
     230    def featuretype(self, typename='entries'): 
    231231        if not self._featuretype: 
    232232            if not self._document: 
     
    234234            self._featuretype = type("%sFeature" % str(self._document.feed.id),  
    235235                (GeoRSSFeature,),  
    236                 dict(__typename__='feed', 
     236                dict(__typename__='entries', 
    237237                     __srs__ = SpatialReference(epsg=4326), 
    238238                     _storage = self, 
     
    251251    def typenames(self): 
    252252        """Returns the typenames available in this store.""" 
    253         return ['feed'] 
     253        return ['entries'] 
    254254 
    255255         
  • PCL/branches/PCL-newfeatureapi/PCL-GeoRSS/tests/Features.txt

    r645 r647  
    1212    >>> store = GeoRSSFeatureStore("file://%s" % path) 
    1313    >>> store.typenames() 
    14     ['feed'] 
     14    ['entries'] 
    1515 
    16     >>> Feed = store.featuretype('feed') 
    17     >>> print Feed 
     16    >>> Entry = store.featuretype('entries') 
     17    >>> print Entry 
    1818    <class 'cartography.data.georss.http://gispython.org/testingFeature'> 
    19     >>> Feed.features.count 
     19    >>> Entry.features.count 
    2020    4 
    2121 
    22     >>> features = [f for f in Feed.features.all()] 
     22    >>> features = [f for f in Entry.features.all()] 
    2323    >>> len(features) 
    2424    4 
     
    3131    >>> store = GeoRSSFeatureStore('http://pleiades.stoa.org/places/archaic.atom') 
    3232    >>> store.typenames() 
    33     ['feed'] 
     33    ['entries'] 
    3434 
    35     >>> Feed = store.featuretype('feed') 
    36     >>> print Feed 
     35    >>> Entry = store.featuretype('entries') 
     36    >>> print Entry 
    3737    <class 'cartography.data.georss.http://pleiades.stoa.org/places/archaicFeature'> 
    38     >>> Feed.features.count 
     38    >>> Entry.features.count 
    3939    3 
    4040 
    41     >>> features = [f for f in Feed.features.all()] 
     41    >>> features = [f for f in Entry.features.all()] 
    4242    >>> len(features) 
    4343    3 
     
    4848    ------------------------- 
    4949 
    50     >>> store = GeoRSSFeatureStore('http://pleiades.stoa.org/places/settlement.atom') 
    51     >>> Feed = store.featuretype('feed') 
    52     >>> Feed.features.count 
     50    >>> url = 'http://pleiades.stoa.org/places/settlement.atom' 
     51    >>> store = GeoRSSFeatureStore(url) 
     52    >>> Entry = store.featuretype('entries') 
     53    >>> Entry.features.count 
    5354    230 
    5455 
    5556    Filter for intersection with a (29dE, 36dN, 30dE, 37dN) bounding box 
    5657 
    57     >>> features = [f for f in Feed.features.filter(bbox=(29.0,36.0,30.0,37.0))] 
     58    >>> features = [f for f in Entry.features.filter( 
     59    ...                        bbox=(29.0, 36.0, 30.0, 37.0) 
     60    ...                        ) 
     61    ...            ] 
    5862    >>> len(features) 
    5963    62 
    60     >>> print features[0].info() 
    61     {'srs': 'None', 'properties': {'updated': u'', 'summary': u'An ancient settlement, attested during the Classical, Hellenistic (Roman Republic), Roman and Late Antique periods (modern location: Ka\u015f). It was known in antiquity by the names: Antiphellos and Habesos.', 'tags': [], 'title': u'Antiphellos/Habesos'}, 'id': 'http://pleiades.stoa.org/places/638749', 'bounds': [29.637, 36.193199999999997, 29.637, 36.193199999999997]} 
     64    >>> from pprint import pprint 
     65    >>> pprint(features[0].info()) 
     66    {'bounds': [29.637, 36.193199999999997, 29.637, 36.193199999999997], 
     67     'id': 'http://pleiades.stoa.org/places/638749', 
     68     'properties': {'summary': u'An ancient settlement, attested during the Classical, Hellenistic (Roman Republic), Roman and Late Antique periods (modern location: Ka\u015f). It was known in antiquity by the names: Antiphellos and Habesos.', 
     69                    'tags': [], 
     70                    'title': u'Antiphellos/Habesos', 
     71                    'updated': u''}, 
     72     'srs': 'None'} 
     73    >>> f = features[0] 
     74    >>> f.id 
     75    'http://pleiades.stoa.org/places/638749' 
     76    >>> f.properties.title 
     77    u'Antiphellos/Habesos' 
     78    >>> f.properties.the_geom.toWKT() 
     79    'POINT (29.6370000000000005 36.1931999999999974)' 
     80    >>> type(f.context) 
     81    <class 'feedparser.FeedParserDict'> 
    6282 
    6383    With property equals filter 
     
    6686    >>> path = os.path.abspath('../fixtures/atom-tagged.xml') 
    6787    >>> store = GeoRSSFeatureStore("file://%s" % path) 
    68     >>> Feed = store.featuretype('feed') 
    69     >>> Feed.features.count 
     88    >>> Entry = store.featuretype('entries') 
     89    >>> Entry.features.count 
    7090    31 
    7191 
    72     >>> features = [f for f in Feed.features.filter(properties="'web' in f.tags")] 
     92    >>> features = [f for f in Entry.features.filter(properties="'web' in f.tags")] 
    7393    >>> len(features) 
    7494    12 
    7595    >>> print features[0].info() 
    7696    {'srs': 'None', 'properties': {'updated': u'2007-03-23T08:28:33-06:00', 'summary': u'Sam Ruby finds GeoRSS and finds it a bit confusing. My blog entries feed validates perfectly,\nunlike the slashgeo feed Google references.', 'tags': [u'web'], 'title': u'GeoRSS and Validation'}, 'id': 'http://zcologia.com/news/entries/412', 'bounds': [-105.09583000000001, 40.58699, -105.09583000000001, 40.58699]} 
     97    >>> f = features[0] 
     98    >>> f.id 
     99    'http://zcologia.com/news/entries/412' 
     100    >>> f.properties.title 
     101    u'GeoRSS and Validation' 
     102    >>> f.properties.tags 
     103    [u'web'] 
     104    >>> f.properties.the_geom.toWKT() 
     105    'POINT (-105.0958300000000065 40.5869900000000001)' 
     106    >>> type(f.context) 
     107    <class 'feedparser.FeedParserDict'> 
     108    >>> f.context.tags 
     109    [{'term': u'web', 'scheme': u'http://zcologia.com/news/categories/', 'label': u'Web'}] 
    77110