Changeset 4431
- Timestamp:
- 17/11/08 13:08:52 (12 years ago)
- Location:
- cows/trunk/cows
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cows/trunk/cows/pylons/wfs_controller.py
r4429 r4431 161 161 a set of wfs:members containing property values expressed in the xpath""" 162 162 resultset=[] 163 for feature in features: 164 featureXML=feature._feature.elem #the underlying XML 165 valuecomponent=featureXML.find(xpath) 166 if valuecomponent is not None: 167 valstr=etree.tostring(valuecomponent) 168 resultset.append(valstr) 163 #if xpath is looking for an attribute, handle it differently - this should be unnecessary when migrated to element tree 1.3 164 #i.e. if of the form /somepath/path[@attribute] 165 attstart=xpath.find('[') 166 if attstart == -1: #no attribute 167 for feature in features: 168 featureXML=feature._feature.elem #the underlying XML 169 valuecomponent=featureXML.find(xpath) 170 if valuecomponent is not None: 171 valstr=etree.tostring(valuecomponent) 172 resultset.append(valstr) 173 else: 174 #there is an attribute: 175 attributeName=xpath.split('[')[1][1:-1] 176 xpath=xpath.split('[')[0] 177 for feature in features: 178 featureXML=feature._feature.elem #the underlying XML 179 log.debug('xpath path %s'%xpath) 180 log.debug('attribute %s'%attributeName) 181 if len(xpath) ==0: 182 valuecomponent=featureXML 183 else: 184 valuecomponent=featureXML.find(xpath) 185 log.debug('valuecomponent %s'%valuecomponent) 186 if valuecomponent is not None: 187 attribute=valuecomponent.get(attributeName) 188 #TODO: important- how does WFS 2.0 represent xml attribute content?? if it does at all?? 189 #for now, have created element from attribute name e.g. <gml:id> 190 newelem=etree.Element(attributeName) 191 newelem.text=attribute 192 valstr=etree.tostring(newelem) 193 resultset.append(valstr) 194 log.debug(resultset) 169 195 return resultset 170 196 -
cows/trunk/cows/service/imps/csmlbackend/wfs_csmlstoredqueries.py
r4422 r4431 15 15 import csml.parser 16 16 from xml.etree import ElementTree as etree 17 from pylons import request, config 17 18 18 19 class dummyfeaturefortesting(object): … … 33 34 return featureset.getFeaturesByPropertyEqualTo('csml:parameter', phenomenon) 34 35 35 def query_extractPointFromPointSeries(featureset, timeinstance):36 def query_extractPointFromPointSeries(featureset, featureid, timeinstance): 36 37 #TODO: configure output directory 37 38 #TODO: error handling 38 feature=featureset.getFeatureByGMLid('S9c7oW2p')._feature 39 newfeature, netcdfpath, storagedescriptor=feature.subsetToPoint(time=str(timeinstance), outputdir='/home/dom/csmlstore/csmlout') 39 csmloutputdir=config['publish_dir'] 40 feature=featureset.getFeatureByGMLid(featureid)._feature 41 newfeature, netcdfpath, storagedescriptor=feature.subsetToPoint(time=str(timeinstance), outputdir=csmloutputdir) 40 42 #wrap this in a wfs CSMLFeatureInstance object: 41 43 csmlfi=wfs_csmllayer.CSMLFeatureInstance('subset feature title', 'subset feature abstract', newfeature) … … 43 45 qualifiedFeatureType='{http://ndg.nerc.ac.uk/csml}' + storagedescriptor.__class__.__name__ 44 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 45 50 csmlelem=storagedescriptor.toXML(emptyelem) 46 51 storagedescXML=etree.tostring(csmlelem)
Note: See TracChangeset
for help on using the changeset viewer.