Ignore:
Timestamp:
21/11/08 14:22:57 (13 years ago)
Author:
domlowe
Message:

Fixes to enable Point and GridSeries? subsetting in WFS.

File:
1 edited

Legend:

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

    r4439 r4481  
    3434    return featureset.getFeaturesByPropertyEqualTo('csml:parameter', phenomenon)     
    3535 
     36def query_getFeatureById(featureset, id): 
     37    return [featureset.getFeatureByGMLid(id)] 
     38 
    3639def query_extractPointFromPointSeries(featureset, featureid, timeinstance): 
    3740    #TODO:  configure output directory 
     
    4043    feature=featureset.getFeatureByGMLid(featureid)._feature 
    4144    newfeature, netcdfpath, storagedescriptor=feature.subsetToPoint(time=str(timeinstance), outputdir=csmloutputdir)         
    42     #wrap this in a wfs CSMLFeatureInstance object: 
     45     
     46    #modify the rangeset of the feature to store the data inline and discard the storage descriptor. 
     47    storagedescriptor.fileName.CONTENT=csmloutputdir+'/'+storagedescriptor.fileName.CONTENT     
     48    data=storagedescriptor.getData() 
     49    qlist=csml.parser.MeasureOrNullList() 
     50    qlist.uom=newfeature.value.rangeSet.valueArray.valueComponent.uom 
     51    qlist.CONTENT=str(data[0]) 
     52    rs=csml.parser.RangeSet() 
     53    rs.quantityList=qlist     
     54    newfeature.value.rangeSet=rs 
     55     
     56    #wrap the feature in a wfs CSMLFeatureInstance object: 
    4357    csmlfi=wfs_csmllayer.CSMLFeatureInstance('subset feature title', 'subset feature abstract', newfeature) 
     58     
     59     
     60    return [csmlfi] 
     61    #This following code is used to maintain the storage descriptor filename consistency, but has been commented out for this  
     62    #operation as there is only a single point value. However code is left here as reminder as it will be needed  
     63    #for other feature types soon 
     64    #change the path of the storage descriptor to the download url - assumes routes maps to filestore 
     65     
    4466    #And serialise the storage descriptor as XML. 
    45     qualifiedFeatureType='{http://ndg.nerc.ac.uk/csml}' + storagedescriptor.__class__.__name__  
    46     emptyelem=etree.Element(qualifiedFeatureType) 
    47     log.debug(request.environ) 
    48     #change the path of the storage descriptor to the download url - assumes routes maps to filestore 
    49     storagedescriptor.fileName.CONTENT='http://'+request.environ['HTTP_HOST']+'/filestore/' +storagedescriptor.fileName.CONTENT 
    50     csmlelem=storagedescriptor.toXML(emptyelem) 
    51     storagedescXML=etree.tostring(csmlelem)       
    52     return [csmlfi], [storagedescXML] 
     67#    qualifiedFeatureType='{http://ndg.nerc.ac.uk/csml}' + storagedescriptor.__class__.__name__  
     68#    emptyelem=etree.Element(qualifiedFeatureType) 
     69#    log.debug(request.environ)     
     70#    storagedescriptor.fileName.CONTENT='http://'+request.environ['HTTP_HOST']+'/filestore/' +storagedescriptor.fileName.CONTENT 
     71#    csmlelem=storagedescriptor.toXML(emptyelem) 
     72#    storagedescXML=etree.tostring(csmlelem)       
     73#    return [csmlfi], [storagedescXML] 
     74 
    5375 
    5476def query_extractGridSeriesFromGridSeries(featureset, featureid, bbox, timerange): 
Note: See TracChangeset for help on using the changeset viewer.