Changeset 5131 for cows


Ignore:
Timestamp:
23/03/09 13:06:29 (10 years ago)
Author:
domlowe
Message:

typename parameter enabled in WFS

Location:
cows/trunk/cows
Files:
2 edited

Legend:

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

    r4912 r5131  
    141141        return xmlschema 
    142142     
    143     def _runQuery(self, queryxml = None, storedqueryid=None, **kwargs): 
     143    def _runQuery(self, queryxml = None, storedqueryid=None, typename=None, **kwargs): 
    144144        """ this is used by both the GetFeature and GetPropertyValue methods to 
    145145        run a wfs:query over a featurecollection and return a subset of the collection.  
     
    161161            log.debug('Final resultset from stored query %s'%resultset) 
    162162        else:            
    163             #If neither query or storedquery_id are provided then return entire featureset 
     163            #If neither query or storedquery_id are provided then return entire featureset, filtered on 'typename' if supplied. 
    164164            resultset=self.featureset.getFeatureList() 
     165            if typename: 
     166                templist = resultset[:] 
     167                for feature in templist: 
     168                    if feature.featuretype != typename: 
     169                        resultset.remove(feature) 
     170                resultset=resultset 
    165171        return resultset, additionalobjects 
    166172 
     
    224230        queryxml=self.getOwsParam('query',default=None) 
    225231        storedqueryid=self.getOwsParam('storedquery_id', default=None) 
     232        typename=self.getOwsParam('typename', default=None) 
    226233        #get any other parameters from self._owsParams and pass them to the stored query 
    227234        otherparams={} 
    228235        for key in self._owsParams.keys(): 
    229             if key not in ['query', 'request', 'service', 'version', 'storedquery_id', 'valuereference']: 
     236            if key not in ['query', 'request', 'service', 'version', 'storedquery_id', 'typename', 'valuereference']: 
    230237                otherparams[key]=self._owsParams[key]      
    231         featureresultset, additionalobjects =self._runQuery(queryxml, storedqueryid, **otherparams)         
     238        featureresultset, additionalobjects =self._runQuery(queryxml, storedqueryid, typename **otherparams)         
    232239        
    233240        #Now need to take account of valueReferencexpath, and distill the  
  • cows/trunk/cows/service/imps/csmlbackend/wfs_csmllayer.py

    r4912 r5131  
    6767            featureset.featureinstances[feature.id]=CSMLFeatureInstance(title, abstract, feature)              
    6868        for id, instance in featureset.featureinstances.iteritems(): 
    69             ftype='csml:' + instance.featuretype 
     69            ftype=instance.featuretype #namespaced type e.g. 'csml:PointSeriesFeature' 
    7070            if ftype not in layermap.keys(): 
    7171                layermap[ftype]=CSMLwfsLayer(ftype, instance.wgs84BBox) 
     
    232232        self.abstract=abstract 
    233233        self._feature=feature 
    234         self.featuretype=self._feature.__class__.__name__ 
     234        self.featuretype='csml:'+self._feature.__class__.__name__ 
    235235        try: 
    236236            bb= self._feature.getCSMLBoundingBox().getBox() 
     
    244244    def toGML(self): 
    245245        """ Create a GML (CSML) representation of the feature """ 
    246         qualifiedFeatureType='{http://ndg.nerc.ac.uk/csml}' + self.featuretype 
     246        nonamespaceFType=self.featuretype.split(':')[1] #remove the csml: prefix 
     247        qualifiedFeatureType='{http://ndg.nerc.ac.uk/csml}' + nonamespaceFType 
    247248        emptyelem=etree.Element(qualifiedFeatureType) 
    248249        csmlelem=self._feature.toXML(emptyelem) 
Note: See TracChangeset for help on using the changeset viewer.