Changeset 1041
- Timestamp:
- 01/30/08 07:16:42
- Files:
-
- OWSLib/branches/wcstemp/owslib/coverage/wcs100.py (modified) (1 diff)
- OWSLib/branches/wcstemp/owslib/coverage/wcs110.py (modified) (2 diffs)
- OWSLib/branches/wcstemp/tests/wcs_newiface.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OWSLib/branches/wcstemp/owslib/coverage/wcs100.py
r1036 r1041 199 199 except AttributeError: 200 200 self.name='' 201 self.url ="URL for provider's web site (string)." #TODO 202 self.contact = "How to contact the service provider (string)." #TO DECIDE - simple attributes? 203 204 205 #TO DECIDE: may not keep these contact info classes 206 class Address(object): 207 def __init__(self,elem): 208 try: 209 self.deliveryPoint=elem.find(ns('deliveryPoint')).text 210 except AttributeError: 211 self.deliveryPoint='' 212 try: 213 self.city=elem.find(ns('city')).text 214 except AttributeError: 215 self. city='' 216 try: 217 self.administrativeArea=elem.find(ns('administrativeArea')).text 218 except AttributeError: 219 self.administrativeArea='' 220 try: 221 self.postalCode=elem.find(ns('postalCode')).text 222 except AttributeError: 223 self.postalCode='' 224 try: 225 self.country=elem.find(ns('country')).text 226 except AttributeError: 227 self.country='' 228 try: 229 self.electronicMailAddress=elem.find(ns('electronicMailAddress')).text 230 except AttributeError: 231 self.electronicMailAddress='' 232 self.email=self.electronicMailAddress #shorthand alias 233 234 class Phone(object): 235 def __init__(self,elem): 236 try: 237 self.voice=elem.find(ns('voice')).text 201 self.url=self.name #there is no definitive place for url WCS, repeat organisationName 202 try: 203 self.contact = elem.find(ns('contactInfo')+'/'+ns('address')+'/'+ns('electronicMailAddress')).text #use email address for contact 238 204 except: 239 self.voice='' 240 try: 241 self.facsimile=elem.find(ns('facsimile')).text 242 self.fax=self.facsimile #shorthand alias 243 except: 244 self.facsimile='' 245 self.fax='' 246 247 class ContactInfo(object): 248 def __init__(self,elem): 249 #self.address=elem.find 250 self.phone=Phone(elem.find(ns('phone'))) 251 self.address=Address(elem.find(ns('address'))) 252 253 205 self.contact='' 206 254 207 class ContentMetadata(object): 255 208 """ OWSLib/branches/wcstemp/owslib/coverage/wcs110.py
r1036 r1041 89 89 items.append((item,self.servicecontents[item])) 90 90 return items 91 92 93 #TO DECIDE: May need something like this94 #def _getaddressString(self):95 #address=self.capabilities.serviceProvider.serviceContact.contactInfo.address.deliveryPoint96 #return address97 91 98 92 #TO DECIDE: Offer repackaging of coverageXML/Multipart MIME output? … … 234 228 self.name=elem.find('{http://www.opengis.net/ows}ProviderName').text 235 229 #self.contact=ServiceContact(elem.find('{http://www.opengis.net/ows}ServiceContact')) 236 self.contact = "How to contact the service provider (string)." #TO DECIDE - simple attributes? 237 self.url="URL for provider's web site (string)." 238 239 240 #TO DECIDE: How to model the contact detials - explicitly or truncated? 241 class Address(object): 242 def __init__(self,elem): 243 self.deliveryPoint=elem.find('{http://www.opengis.net/ows}DeliveryPoint').text 244 self.city=elem.find('{http://www.opengis.net/ows}City').text 245 self.administrativeArea=elem.find('{http://www.opengis.net/ows}AdministrativeArea').text 246 self.postalCode=elem.find('{http://www.opengis.net/ows}PostalCode').text 247 self.country=elem.find('{http://www.opengis.net/ows}Country').text 248 self.electronicMailAddress=elem.find('{http://www.opengis.net/ows}ElectronicMailAddress').text 249 self.email=self.electronicMailAddress #shorthand alias 250 251 252 class Phone(object): 253 def __init__(self,elem): 254 self.voice=elem.find('{http://www.opengis.net/ows}Voice').text 255 self.facsimile=elem.find('{http://www.opengis.net/ows}Facsimile').text 256 self.fax=self.facsimile #shorthand alias 257 258 class ContactInfo(object): 259 def __init__(self,elem): 260 #self.address=elem.find 261 self.phone=Phone(elem.find('{http://www.opengis.net/ows}Phone')) 262 self.address=Address(elem.find('{http://www.opengis.net/ows}Address')) 263 264 265 class ServiceContact(object): 266 def __init__(self,elem): 267 self.individualName=elem.find('{http://www.opengis.net/ows}IndividualName').text 268 self.positionName=elem.find('{http://www.opengis.net/ows}PositionName').text 269 contact=elem.find('{http://www.opengis.net/ows}ContactInfo') 270 if contact is not None: 271 self.contactInfo=ContactInfo(contact) 272 else: 273 self.contactInfo = None 274 275 230 self.contact = elem.find('{http://www.opengis.net/ows}ServiceContact/{http://www.opengis.net/ows}ContactInfo/{http://www.opengis.net/ows}Address/{http://www.opengis.net/ows}ElectronicMailAddress').text # use email address for simple contact info 231 self.url=elem.find('{http://www.opengis.net/ows}ProviderName').text # no obvious definitive place for url in wcs, repeat provider name. 232 233 276 234 class ContentMetadata(object): 277 235 """Abstraction for WCS CoverageSummary OWSLib/branches/wcstemp/tests/wcs_newiface.txt
r1036 r1041 29 29 'British Atmospheric Data Centre' 30 30 >>> wcs.provider.url 31 "URL for provider's web site (string)."31 'British Atmospheric Data Centre' 32 32 >>> wcs.provider.contact 33 ' How to contact the service provider (string).'33 'tba@badc.rl.ac.uk' 34 34 >>> type(wcs.items()) 35 35 <type 'list'> … … 81 81 'British Atmospheric Data Centre' 82 82 >>> wcs.provider.url 83 "URL for provider's web site (string)."83 'British Atmospheric Data Centre' 84 84 >>> wcs.provider.contact 85 ' How to contact the service provider (string).'85 'tba@badc.rl.ac.uk' 86 86 >>> type(wcs.items()) 87 87 <type 'list'>
