Changeset 1026
- Timestamp:
- 01/23/08 02:45:10
- Files:
-
- OWSLib/branches/wcstemp/owslib/coverage/wcs100.py (modified) (4 diffs)
- OWSLib/branches/wcstemp/owslib/coverage/wcs110.py (modified) (5 diffs)
- OWSLib/branches/wcstemp/tests/wcs_newiface.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OWSLib/branches/wcstemp/owslib/coverage/wcs100.py
r1025 r1026 62 62 self.servicecontents={} 63 63 for elem in self._capabilities.findall(ns('ContentMetadata/')+ns('CoverageOfferingBrief')): 64 cm=ContentMetadata(elem) 65 #make the describeCoverage requests to populate the supported formats/crs attributes 66 cm.supportedFormats=self._getSupportedFormats(cm.id) 67 cm.supportedCRS=self._getSupportedCRS(cm.id) 64 cm=ContentMetadata(elem, self) 68 65 self.servicecontents[cm.id]=cm 69 66 … … 134 131 u.seek(0) 135 132 return u 136 137 def _getSupportedCRS(self,identifier): 138 # gets supported crs info 139 crss=[] 140 for elem in self.getDescribeCoverage(identifier).findall(ns('CoverageOffering/')+ns('supportedCRSs/')+ns('responseCRSs')): 141 crss.append(elem.text) 142 return crss 143 144 def _getSupportedFormats(self,identifier): 145 # gets supported formats info 146 frmts =[] 147 for elem in self.getDescribeCoverage(identifier).findall(ns('CoverageOffering/')+ns('supportedFormats/')+ns('formats')): 148 frmts.append(elem.text) 149 return frmts 150 133 151 134 def _getOperationByName(self, name): 152 135 """Return a named operation item.""" … … 257 240 Implements IContentMetadata 258 241 """ 259 def __init__(self, elem ):260 """Initialize. """242 def __init__(self, elem, service): 243 """Initialize. service is required so that describeCoverage requests may be made""" 261 244 #TODO - examine the parent for bounding box info. 262 245 263 246 #self._parent=parent 247 self._service=service 264 248 self.id=elem.find(ns('name')).text 265 249 self.title =elem.find(ns('label')).text … … 295 279 296 280 #SupportedCRS, SupportedFormats 297 #these require a seperate describeCoverage request... for now set to None 298 self.supportedCRS=None 299 self.supportedFormats=None 281 #these require a seperate describeCoverage request... only resolve when requested 282 283 def _getSupportedCRSProperty(self): 284 # gets supported crs info 285 crss=[] 286 for elem in self._service.getDescribeCoverage(self.id).findall(ns('CoverageOffering/')+ns('supportedCRSs/')+ns('responseCRSs')): 287 crss.append(elem.text) 288 return crss 289 supportedCRS=property(_getSupportedCRSProperty, None) 290 291 292 def _getSupportedFormatsProperty(self): 293 # gets supported formats info 294 frmts =[] 295 for elem in self._service.getDescribeCoverage(self.id).findall(ns('CoverageOffering/')+ns('supportedFormats/')+ns('formats')): 296 frmts.append(elem.text) 297 return frmts 298 supportedFormats=property(_getSupportedFormatsProperty, None) 299 300 OWSLib/branches/wcstemp/owslib/coverage/wcs110.py
r1025 r1026 72 72 top = self._capabilities.find('{http://www.opengis.net/wcs/1.1}Contents/{http://www.opengis.net/wcs/1.1}CoverageSummary') 73 73 for elem in self._capabilities.findall('{http://www.opengis.net/wcs/1.1}Contents/{http://www.opengis.net/wcs/1.1}CoverageSummary/{http://www.opengis.net/wcs/1.1}CoverageSummary'): 74 cm=ContentMetadata(elem, top) 75 #make the describeCoverage requests to populate the supported formats/crs attributes 76 cm.supportedFormats=self._getSupportedFormats(cm.id) 77 cm.supportedCRS=self._getSupportedCRS(cm.id) 78 cm.timelimits=self._getTimes(cm.id) 74 cm=ContentMetadata(elem, top, self) 79 75 self.servicecontents[cm.id]=cm 80 76 … … 85 81 cm=ContentMetadata(elem, top) 86 82 #make the describeCoverage requests to populate the supported formats/crs attributes 87 cm.supportedFormats=self._getSupportedFormats(cm.id)88 cm.supportedCRS=self._getSupportedCRS(cm.id)89 83 cm.timelimits=self._getTimes(cm.id) 90 84 self.servicecontents[cm.id]=cm … … 113 107 return frmts 114 108 115 def _getTimes(self, identifier): 116 timelimits=[] 117 for elem in self.getDescribeCoverage(identifier).findall(ns('CoverageDescription/')+ns('Domain/')+ns('TemporalDomain/')+ns('TimePeriod/')): 118 subelems=elem.getchildren() 119 timelimits=[subelems[0].text,subelems[1].text] 120 return timelimits 109 121 110 122 111 #TO DECIDE: May need something like this … … 283 272 """Abstraction for WCS CoverageSummary 284 273 """ 285 def __init__(self, elem, parent ):274 def __init__(self, elem, parent, service): 286 275 """Initialize.""" 287 276 #TODO - examine the parent for bounding box info. 288 277 278 self._service=service 289 279 self._elem=elem 290 280 self._parent=parent … … 339 329 self.supportedFormats.append(format.text) 340 330 331 332 #time limits requires a describeCoverage request therefore only resolve when requested 333 def _getTimes(self): 334 timelimits=[] 335 for elem in self._service.getDescribeCoverage(self.id).findall(ns('CoverageDescription/')+ns('Domain/')+ns('TemporalDomain/')+ns('TimePeriod/')): 336 subelems=elem.getchildren() 337 timelimits=[subelems[0].text,subelems[1].text] 338 return timelimits 339 timelimits=property(_getTimes, None) 340 341 341 def _checkChildAndParent(self, path): 342 342 ''' checks child coverage summary, and if item not found checks higher level coverage summary''' OWSLib/branches/wcstemp/tests/wcs_newiface.txt
r1025 r1026 99 99 ['2024-01-15', '2054-12-15'] 100 100 >>> cvg.supportedFormats 101 [' cf-netcdf']101 ['application/cf-netcdf'] 102 102 >>> cvg.supportedCRS 103 [' srstba']103 ['WGS84'] 104 104 105 105 GetCoverage returning Multipart Mime:
