Ignore:
Timestamp:
18/11/08 15:23:13 (12 years ago)
Author:
domlowe
Message:

Support for gridseries subsetting stored query

File:
1 edited

Legend:

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

    r4431 r4439  
    5151    storagedescXML=etree.tostring(csmlelem)       
    5252    return [csmlfi], [storagedescXML] 
     53 
     54def query_extractGridSeriesFromGridSeries(featureset, featureid, bbox, timerange): 
     55    #TODO factor out code in common with other subsetting queries 
     56    csmloutputdir=config['publish_dir'] 
     57    feature=featureset.getFeatureByGMLid(featureid)._feature 
     58    #break the bounding box into latitude and longitude:  
     59    #TODO, this really needs to be generic and refer to the srs of the underlying feature. 
     60    bb=str(bbox).split(',') 
     61    lat=(float(bb[1]),float(bb[3])) 
     62    lon=(float(bb[0]),float(bb[2])) 
     63    log.debug('requesting latitude: %s, longitude: %s'%(lat, lon)) 
     64    newfeature, netcdfpath, storagedescriptor=feature.subsetToGridSeries(time=str(timerange), latitude=lat, longitude=lon, outputdir=csmloutputdir) 
     65    #wrap this in a wfs CSMLFeatureInstance object: 
     66    csmlfi=wfs_csmllayer.CSMLFeatureInstance('subset feature title', 'subset feature abstract', newfeature) 
     67    #And serialise the storage descriptor as XML. 
     68    qualifiedFeatureType='{http://ndg.nerc.ac.uk/csml}' + storagedescriptor.__class__.__name__  
     69    emptyelem=etree.Element(qualifiedFeatureType) 
     70    log.debug(request.environ) 
     71    #change the path of the storage descriptor to the download url - assumes routes maps to filestore 
     72    storagedescriptor.fileName.CONTENT='http://'+request.environ['HTTP_HOST']+'/filestore/' +storagedescriptor.fileName.CONTENT 
     73    csmlelem=storagedescriptor.toXML(emptyelem) 
     74    storagedescXML=etree.tostring(csmlelem) 
     75    return [csmlfi], [storagedescXML] 
     76     
Note: See TracChangeset for help on using the changeset viewer.