Changeset 1128

Show
Ignore:
Timestamp:
07/29/08 09:06:30
Author:
domlowe
Message:

several changes to WCS 1.1.0 client following testing against univ of florence server

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OWSLib/trunk/owslib/coverage/wcs110.py

    r1127 r1128  
    171171                 
    172172        # check for service exceptions, and return 
    173         if u.info()['Content-Type'] == 'text/xml':           
    174             #going to have to read the xml to see if it's an exception report. 
    175             #wrap the url stram in a extended StringIO object so it's re-readable 
    176             u=RereadableURL(u)       
    177             se_xml= u.read() 
    178             se_tree = etree.fromstring(se_xml) 
    179             serviceException=se_tree.find('{http://www.opengis.net/ows}Exception') 
    180             if serviceException is not None: 
    181                 raise ServiceException, \ 
    182                 str(serviceException.text).strip() 
    183             u.seek(0) 
     173        if 'content-type' in u.info().keys():       
     174            if u.info()['content-type'] == 'text/xml':           
     175                #going to have to read the xml to see if it's an exception report. 
     176                #wrap the url stram in a extended StringIO object so it's re-readable 
     177                u=RereadableURL(u)       
     178                se_xml= u.read() 
     179                se_tree = etree.fromstring(se_xml) 
     180                serviceException=se_tree.find('{http://www.opengis.net/ows}Exception') 
     181                if serviceException is not None: 
     182                    raise ServiceException, \ 
     183                    str(serviceException.text).strip() 
     184                u.seek(0) 
    184185        return u 
    185186         
     
    212213        self.version="1.1.0" 
    213214        self.title = elem.find('{http://www.opengis.net/ows}Title').text 
    214         self.abstract = elem.find('{http://www.opengis.net/ows}Abstract').text 
     215        if elem.find('{http://www.opengis.net/ows}Abstract'): 
     216            self.abstract=elem.find('{http://www.opengis.net/ows}Abstract').text 
     217        else: 
     218            self.abstract = None 
    215219        self.keywords = [f.text for f in elem.findall('{http://www.opengis.net/ows}Keywords/{http://www.opengis.net/ows}Keyword')] 
    216220        #self.link = elem.find('{http://www.opengis.net/wcs/1.1}Service/{http://www.opengis.net/wcs/1.1}OnlineResource').attrib.get('{http://www.w3.org/1999/xlink}href', '') 
    217221                
    218         #NOTE: do these belong here? 
    219         self.fees=elem.find('{http://www.opengis.net/wcs/1.1/ows}Fees').text 
    220         self.accessConstraints=elem.find('{http://www.opengis.net/wcs/1.1/ows}AccessConstraints').text 
     222        if elem.find('{http://www.opengis.net/wcs/1.1/ows}Fees'):             
     223            self.fees=elem.find('{http://www.opengis.net/wcs/1.1/ows}Fees').text 
     224        else: 
     225            self.fees=None 
     226         
     227        if   elem.find('{http://www.opengis.net/wcs/1.1/ows}AccessConstraints'): 
     228            self.accessConstraints=elem.find('{http://www.opengis.net/wcs/1.1/ows}AccessConstraints').text 
     229        else: 
     230            self.accessConstraints=None 
    221231        
    222232        
     
    316326                 
    317327        # bboxes - other CRS  
    318         self.boundingBoxes = [] 
     328        self.boundingboxes = [] 
    319329        for bbox in elem.findall('{http://www.opengis.net/ows}BoundingBox'): 
    320330            if bbox is not None: 
    321                 lc=b.find('{http://www.opengis.net/ows}LowerCorner').text 
    322                 uc=b.find('{http://www.opengis.net/ows}UpperCorner').text 
    323                 boundingBox =  ( 
    324                         float(lc.split()[0]),float(lc.split()[1]), 
    325                         float(uc.split()[0]), float(uc.split()[1]), 
    326                         b.attrib['crs']) 
    327                 self.boundingBoxes.append(boundingBox) 
    328          
     331                try: 
     332                    lc=b.find('{http://www.opengis.net/ows}LowerCorner').text 
     333                    uc=b.find('{http://www.opengis.net/ows}UpperCorner').text 
     334                    boundingBox =  ( 
     335                            float(lc.split()[0]),float(lc.split()[1]), 
     336                            float(uc.split()[0]), float(uc.split()[1]), 
     337                            b.attrib['crs']) 
     338                    self.boundingboxes.append(boundingBox) 
     339                except: 
     340                     pass 
     341                 
    329342        #SupportedCRS 
    330343        self.supportedCRS=[] 
     
    365378     
    366379    #TODO timepositions property 
     380    def _getTimePositions(self): 
     381        return [] 
     382    timepositions=property(_getTimePositions, None) 
    367383     
    368384    def _checkChildAndParent(self, path): 
  • OWSLib/trunk/owslib/coverage/wcsBase.py

    r1095 r1128  
    129129        if 'version' not in params: 
    130130            qs.append(('version', self.version)) 
    131          
    132131        if self.version == '1.0.0': 
    133132            if 'coverage' not in params: 
    134133                qs.append(('coverage', self.identifier)) 
    135134        elif self.version == '1.1.0': 
     135            #NOTE: WCS 1.1.0 is ambigous about whether it should be identifier 
     136            #or identifiers (see tables 9, 10 of specification)   
    136137            if 'identifiers' not in params: 
    137138                qs.append(('identifiers', self.identifier)) 
     139            if 'identifier' not in params: 
     140                qs.append(('identifier', self.identifier)) 
    138141                qs.append(('format', 'text/xml')) 
    139142        urlqs = urlencode(tuple(qs))