Changeset 4289 for cows/trunk


Ignore:
Timestamp:
06/10/08 16:37:24 (11 years ago)
Author:
domlowe
Message:

unfinished implementation of getFeature

Location:
cows/trunk/cows
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cows/trunk/cows/pylons/wfs_controller.py

    r4288 r4289  
    5454 
    5555        """ 
    56         print "loading layers" 
     56        log.debug('loading layers') 
    5757        self.layers, self.featureinstances = self.layerMapper.map(**kwargs) 
     58        log.debug('Feature instances %s'%self.featureinstances) 
    5859     
    5960        #------------------------------------------------------------------------- 
     
    160161        """ GetFeature request 
    161162        """ 
     163        #TODO QUERY model 
    162164        version = self.getOwsParam('version', default=self.validVersions[0]) 
    163165        if version not in self.validVersions: 
    164166            raise InvalidParameterValue('Version %s not supported' % version, 
    165167                                        'version') 
    166         featureid=self.getOwsParam('featureid',default=None) 
     168        featureid=self.getOwsParam('featureid') 
     169        #TODO populate self.featureinstances! 
     170        feature=self.featureinstances[featureid]     
     171        response.headers['content-type'] = 'text/xml' 
     172        return feature.toGML() 
     173         
    167174        if featureid is not None: 
    168             msg = 'feature %s'%featureid 
     175            msg = str(feature) 
    169176        else: 
    170177            msg = 'No feature specified'           
  • cows/trunk/cows/service/imps/csmlbackend/csmlcommon.py

    r4278 r4289  
    9797        @return: aggregated bbox tuple, (llx, lly, urx, ury) 
    9898        """ 
    99         log.debug('Comparing new bbox %s with old bbox %s'%(newbbox, self.bbox)) 
     99#        log.debug('Comparing new bbox %s with old bbox %s'%(newbbox, self.bbox)) 
    100100        #compare new box with old. 
    101101        if newbbox[0] < self.bbox[0]: 
  • cows/trunk/cows/service/imps/csmlbackend/wfs_csmllayer.py

    r4284 r4289  
    77from cows.service.wfs_iface import IwfsLayer, IFeatureInstance 
    88import csml 
     9from xml.etree import ElementTree as etree 
    910 
    1011import logging 
     
    5253        for feature in csml.csmllibs.csmlextra.listify(ds.featureCollection.featureMembers): 
    5354            title, abstract=self._getInfo(feature) 
    54             featureinstances[feature.id]=CSMLFeatureInstance(title, abstract, feature)       
    55          
     55            featureinstances[feature.id]=CSMLFeatureInstance(title, abstract, feature)              
    5656        for id, instance in featureinstances.iteritems(): 
    57             print 'this is a feature %s'%type(instance._feature) 
    5857            ftype='csml:' + instance.featuretype 
    5958            if ftype not in layermap.keys(): 
     
    6463                #the featuretype has already been stored in the dictionary. 
    6564                #but, the bounding box may need changing to accommodate this new feature instance. 
    66                 log.debug('Checking bbox for feature id: %s and title: %s'%(instance._feature.id, instance.title)) 
     65#                log.debug('Checking bbox for feature id: %s and title: %s'%(instance._feature.id, instance.title)) 
    6766                aggregator=bboxAggregators[ftype] 
    6867                aggregator.aggregate(instance.wgs84BBox) 
    6968                layermap[ftype]=CSMLwfsLayer(ftype, aggregator.bbox) 
    70                
     69             
    7170 
    7271        if len(layermap) > 0: 
     
    9493            bb[0], bb[2]=-180, 180 
    9594        self.wgs84BBox = bb 
     95         
     96    def toGML(self): 
     97        """ Create a GML (CSML) representation of the feature """ 
     98         
     99        #TODO un-hardcode this: 
     100        elem=etree.Element('http://csml.badc.rl.ac.uk}GridSeriesFeature') 
     101         
     102        return self._feature.toXML(elem) 
     103         
    96104         
    97105       
  • cows/trunk/cows/service/wfs_iface.py

    r4284 r4289  
    2828     
    2929    type=title=abstract=NotImplemented 
     30     
     31    def toGML(self): 
     32        """ return a GML representation of the feature as a string  
     33        @return: string of GML 
     34        """ 
     35        raise NotImplementedError 
Note: See TracChangeset for help on using the changeset viewer.