Ignore:
Timestamp:
13/01/10 14:12:42 (11 years ago)
Author:
domlowe
Message:

Changes to wfs backend to support point series subsetting in wfs interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cows/trunk/cows/service/imps/csmlbackend/wfs_csmlstoredqueries.py

    r5887 r6305  
    6565    #wrap the feature in a wfs CSMLFeatureInstance object: 
    6666    csmlfi=wfs_csmllayer.CSMLFeatureInstance('subset feature title', 'subset feature abstract', newfeature) 
    67      
    68      
    6967    return [csmlfi] 
    7068    #This following code is used to maintain the storage descriptor filename consistency, but has been commented out for this  
     
    8179#    storagedescXML=etree.tostring(csmlelem)       
    8280#    return [csmlfi], [storagedescXML] 
     81 
     82def query_extractPointSeriesFromPointSeries(featureset, featureid, starttime, endtime): 
     83    csmloutputdir=config['cows.csml.publish_dir'] 
     84    feature=featureset.getFeatureByGMLid(featureid)._feature 
     85    timerange=(starttime, endtime,) 
     86    subsetdictionary={'times':timerange} 
     87    ncname=_getCSMLFilename() 
     88    newfeature, netcdfpath, storagedescriptor=feature.subsetToPointSeries(outputdir=csmloutputdir, ncname=ncname,**subsetdictionary) 
     89    #wrap this in a wfs CSMLFeatureInstance object: 
     90    csmlfi=wfs_csmllayer.CSMLFeatureInstance('subset feature title', 'subset feature abstract', newfeature) 
     91    #And serialise the storage descriptor as XML. 
     92    qualifiedFeatureType='{http://ndg.nerc.ac.uk/csml}' + storagedescriptor.__class__.__name__  
     93    emptyelem=etree.Element(qualifiedFeatureType) 
     94    log.debug(request.environ) 
     95    #change the path of the storage descriptor to the download url - assumes routes maps to filestore 
     96    #TODO: THIS SHOULD HANDLE SERVER PROXIES. 
     97    storagedescriptor.fileName.CONTENT='http://'+request.environ['HTTP_HOST']+'/filestore/' +ncname 
     98    csmlelem=storagedescriptor.toXML(emptyelem) 
     99    storagedescXML=etree.tostring(csmlelem) 
     100    return [csmlfi], [storagedescXML] 
    83101 
    84102 
Note: See TracChangeset for help on using the changeset viewer.